This, or (preferred imo) assign it to a column in rowData() to pin it to the sce. For example as a logical column, rowData(sce)$hvg
Hello everyone,
I am trying to convert my single cell Seurat object to single cell experiment object. When I set the DefaultAssay to "RNA" the sce object does not retain HVGs and when it is set to "integrated" it does not retain count slot. I was wondering how I can retain all of the assays in sce object. Or if I apply the getTopHVGs(als, n=1000) on sce object does it return the same HVGs?
Any comment would be appreciated.
Paria
1 answer
My understanding is there is not a slot for variable genes in a single-cell experiment object. You can retain the calculated variable genes from seurat and store them as a vector to be used in the single-cell experiment workflow using:
var.features <- SeuratObject::VariableFeatures(seuratObj)
There are different assumptions that the Seurat and OSCA/Single-cell experiment workflows use to identify variable features (at default settings), but also a lot of parameters in each function that make them customizable. Likely you will not have the same variable features identified, but hopefully a large overlap.
Thanks for your help. When I am trying to pin the hog to my sce object I aim getting the below error.
variable.feature <- VariableFeatures(ALS)
rowData(als)$hvg <- variable.feature
Error in [[<-(*tmp*, name, value = c("CFAP299", "GALNTL6", "FLT1", :
1000 elements in value to replace 31808 elements
Do you know how to fix this? Thanks
The error says you have tried to create a new column with 1000 elements (length of variable.feature) while it was supposed to be a vector with 31808 elements (all genes present in your dataset). Based on the above comment, you may do the following to specify variable features in your sce dataset:
var.features <- SeuratObject::VariableFeatures(seuratObj)
rowData(sce)$hvg <- ifelse(rownames(rowData(sce)) %in% var.features, TRUE, FALSE)
Log in to answer this question.