Add Seurat components - #77
Merged
Merged
Conversation
lazappi
requested changes
Aug 26, 2025
mumichae
requested changes
Aug 29, 2025
Collaborator
# Conflicts: # CHANGELOG.md
…orkflow Follow the Seurat v5 integration vignette: split the RNA assay into one layer per batch, ScaleData + RunPCA, then IntegrateLayers with CCAIntegration / RPCAIntegration and return the corrected reduction as X_emb. This replaces the v4 SplitObject / FindIntegrationAnchors / IntegrateData path and drops the UMAP that was previously exported as the embedding. Also: - convert dgRMatrix to dgCMatrix sparse-to-sparse instead of via a dense copy - stop loading the counts layer in seurat_rpca; it was unused - forward --dims/--k_anchor/--k_filter/--k_score only when set so Seurat's own defaults apply (k.filter is NA in v5, not 200) - drop the unused X_pca reduction in seurat_rpca
read_h5ad() + as_Seurat() with layers_mapping = c(data = "normalized") builds the Seurat object directly from the h5ad, replacing the manual transpose / sparse conversion / CreateSeuratObject / drop-counts block. Also cite the Seurat v4 paper for seurat_rpca, where RPCA integration was introduced.
Member
Author
|
Merging this already so it can be included in the next run; please let me know if you'd like to see anything changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Adds two Seurat anchor-based integration methods,
methods/seurat_ccaandmethods/seurat_rpca, implemented on the Seurat v5 workflow from https://satijalab.org/seurat/articles/seurat5_integration:split(obj[["RNA"]], f = obj$batch))ScaleData+RunPCAIntegrateLayers(method = CCAIntegration | RPCAIntegration, orig.reduction = "pca")integrated.cca/integrated.rpca) asX_embTwo deliberate deviations from the vignette, so the components use the same input as every other method in the benchmark:
normalizedlayer (log_cp10k, which is Seurat'sLogNormalize) is assigned to thedatalayer instead of callingNormalizeData()var$hvgis used asVariableFeaturesinstead ofFindVariableFeatures()--dims,--k_anchor,--k_filterand--k_scoreare forwarded only when set, so Seurat's own defaults apply otherwise.Checklist before requesting a review
I have performed a self-review of my code
Check the correct box. Does this PR contain:
Proposed changes are described in the CHANGELOG.md
CI Tests succeed and look good!