-
Notifications
You must be signed in to change notification settings - Fork 12
Add Seurat components #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
dense_temp <- as.matrix(norm_data) | ||
norm_data <- as(dense_temp, "dgCMatrix") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
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)
There was a problem hiding this comment.
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.
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 | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
counts_data <- t(adata$layers[["counts"]]) | ||
norm_data <- t(adata$layers[["normalized"]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are both matrices needed?
There was a problem hiding this comment.
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
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") |
There was a problem hiding this comment.
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:
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)
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") |
There was a problem hiding this comment.
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
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") |
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:
Proposed changes are described in the CHANGELOG.md
CI Tests succeed and look good!