Entering edit mode
yaozhan88
•
0
@yaozhan88-22185
Last seen 5.1 years ago
Hi, I am trying to subset the sce object, by selecting specific row names. My code is as follow:
sce = SingleCellExperiment(assays = list(counts = as.matrix(count)), colData = colData, rowData = metaData)
select_name = rownames(sce)[300:400]
sce_select = sce[select_name, ]
The console returned error:
Error in validObject(.Object) :
invalid class "CompressedGRangesList" object:
'mcols(x)' cannot have columns named "seqnames", "ranges", "strand", "start",
"end", "width", or "element"
Coule you please help to fix the issue?
Thank you!
Please provide a reproducible example and your
sessionInfo()
.It looks like somewhere in your
sce
object there is a CompressedGRangesList object that is considered invalid because it has metadata columns that use "forbidden" names.This restriction on the metadata column names of GRanges and GRangeList derivatives was introduced a long time ago by one of the original creators of these classes. I never really understood the reason for this restriction and always found it arbitrary. However I've kept it for all these years because it has never caused trouble in practice. But maybe it's time to get rid of it.
H.