Skip to content

Conversation

rcannood
Copy link
Member

@rcannood rcannood commented Aug 20, 2025

Describe your changes

Checklist before requesting a review

  • I have performed a self-review of my code

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI Tests succeed and look good!

@rcannood rcannood requested a review from mumichae August 20, 2025 15:10
Comment on lines +34 to +35
dense_temp <- as.matrix(norm_data)
norm_data <- as(dense_temp, "dgCMatrix")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be one line to avoid making an extra copy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

Can do!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is intermediate dinsification strictly necessary? I'm worried that could cause a computational bottleneck for larger data

Comment on lines +84 to +93
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(
integrated,
reduction = "pca",
dims = seq_len(par$dims),
verbose = FALSE
)

cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why generate and store a UMAP instead of the integrated embedding?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that, shouldn't it instead be:

Suggested change
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(
integrated,
reduction = "pca",
dims = seq_len(par$dims),
verbose = FALSE
)
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "pca")

Using UMAP for anything other than visualisation isn't common practice (and also not the default way of running the method)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the integration might be stored as something like "integrated" but you would need to check the function calls.

I would suggest following this vignette https://satijalab.org/seurat/articles/seurat5_integration.

Comment on lines +62 to +77
anchors <- FindIntegrationAnchors(
object.list = seurat_list,
anchor.features = hvg_genes,
dims = seq_len(par$dims),
k.anchor = par$k_anchor,
k.filter = par$k_filter,
k.score = par$k_score,
verbose = FALSE
)

# Integrate the data
integrated <- IntegrateData(
anchorset = anchors,
dims = seq_len(par$dims),
verbose = FALSE
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{Seurat} v5 has a new IntegrateLayers function which we should probably use instead https://satijalab.org/seurat/articles/seurat5_integration#perform-streamlined-one-line-integrative-analysis

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. If the models are still the same, we should use the latest implementation for it.

Comment on lines +28 to +29
counts_data <- t(adata$layers[["counts"]])
norm_data <- t(adata$layers[["normalized"]])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are both matrices needed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature selection should ideally be standardised across methods

Comment on lines +84 to +93
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(
integrated,
reduction = "pca",
dims = seq_len(par$dims),
verbose = FALSE
)

cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that, shouldn't it instead be:

Suggested change
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(
integrated,
reduction = "pca",
dims = seq_len(par$dims),
verbose = FALSE
)
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "pca")

Using UMAP for anything other than visualisation isn't common practice (and also not the default way of running the method)

Comment on lines +113 to +117
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(integrated, reduction = "pca", dims = seq_len(par$dims), verbose = FALSE)

cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as comment in CCA

Suggested change
cat("Generate UMAP embedding\n")
integrated <- RunUMAP(integrated, reduction = "pca", dims = seq_len(par$dims), verbose = FALSE)
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "umap")
cat("Extract embedding\n")
embedding <- Embeddings(integrated, reduction = "pca")

@mumichae
Copy link
Collaborator

@rcannood Could you consider updating to the Seurat v5 implementation? That would also resolve most of our reviews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants