You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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
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 :)
The text was updated successfully, but these errors were encountered:
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 theAssay5
format used by Seurat v5 is not recognized, causing the errorError 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()
Connectome/R/PercentExpression_v2.R
Line 18 in 57c44b1
expecting
obj[['RNA']]
to be ofclass
'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 :)The text was updated successfully, but these errors were encountered: