Skip to content
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

Error in Connectome:::PercentExpression_v2() None of the requested assays are present in the object: Assay5 / Seurat v5 format not recognized #13

Open
niklaslang opened this issue Feb 26, 2025 · 0 comments

Comments

@niklaslang
Copy link

Hey,

I was really curious about Connectome and wanted to give it a go :)

However I encountered an error when running CreateConnectome() while using a Seurat v5 object. I believe the function fails because the Assay5 format used by Seurat v5 is not recognized, causing the error

Error in Connectome:::PercentExpression_v2(object, features = genes.use, slot = "counts", assays = assay): None of the requested assays are present in the object
when runnning:
obj.con <- CreateConnectome(obj, species = 'mouse', assay = 'RNA', min.cells.per.ident = 25, p.values = FALSE, calculate.DOR = FALSE)

I assume this is due to PercentExpression_v2()

object.assays <- Seurat:::FilterObjects(object = object, classes.keep = "Assay")

expecting obj[['RNA']] to be of class 'Assay' - when using Seurat v5 (or just in my case, I don't know) it is 'Assay5'.

So when working with Seurat v5 the following workaround might be of help for those facing a similar issue:
`## extract relevant data
counts_data <- obj[['RNA']]$counts
data_data <- obj[['RNA']]$data
scale_data <- obj[['RNA']]$scale.data

create a Seurat v4 style assay object

new_assay <- CreateAssayObject(counts = counts_data)
new_assay@data <- data_data
new_assay@scale.data <- scale_data

assign back to Seurat object

obj[['RNA']] <- new_assay

check - should return 'Assay' now

class(obj[['RNA']])
`

Maybe worth considering to modify PercentExpression_v2() to check for 'Assay' vs. 'Assay5' and handle them respectively, to ensure smooth compatibility with difffernt Seurat version :)

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

No branches or pull requests

1 participant