-
Notifications
You must be signed in to change notification settings - Fork 927
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
Fix GroupCorrelation and GroupCorrelationPlot for Seurat V5 compatibility #9625
base: develop
Are you sure you want to change the base?
Conversation
…) as discussed in issue satijalab#9483
…lot() as discussed in issue satijalab#9483
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.
@joesphbeller. thank you for taking the time and effort to translate your solution into a PR 🙌
I was not sure if this would cause any other functions that depend on GroupCorrelation or GroupCorrelationPlot to fail
AFAIK the blast radius for these two methods should be pretty small. In any case, your solution works well 🎉 That said, the fix could be refined further, so I’ve suggested a couple of improvements.
Thanks again!
try(data <- object[[assay]]@meta.data[, c(feature.group, cor)], silent=T) | ||
try(data <- object[[assay]]@meta.features[, c(feature.group, cor)], silent=T) |
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.
try(data <- object[[assay]]@meta.data[, c(feature.group, cor)], silent=T) | |
try(data <- object[[assay]]@meta.features[, c(feature.group, cor)], silent=T) | |
object[[assay]] <- object[[assay]][[c(feature.group, cor)]] |
try(object[[assay]]@meta.data <- grp.cors, silent = T) | ||
try(object[[assay]]@meta.features <- grp.cors, silent = T) |
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.
try(object[[assay]]@meta.data <- grp.cors, silent = T) | |
try(object[[assay]]@meta.features <- grp.cors, silent = T) | |
object[[assay]] <- AddMetaData(object[[assay]], grp.cors) |
Discussed in issue #9483
Problem
In spatial_vignette.Rmd, GroupCorrelation() and GroupCorrelationPlot() would both generate the following error:
"Error in object[[assay]][] <- grp.cors: object of type 'S4' is not subsettable"
This is because the correlation was being stored in metafeatures, which is no longer an element of the assay in V5.
Solution
Insert 2
try()
statements to make it compatible for previous and most recent versions of Seurat