Bioconductor/OrchestratingSingleCellAnalysis

any(seqnames(location)=="MT") question

tiagochst opened this issue · 2 comments

I just want to double-check this part of the code at OSCA devel - quality control:

is.mito <- any(seqnames(location)=="MT") will give me only a TRUE.

However, I understood this should be a vector or index of features. In that case, this should be
is.mito <- which(seqnames(location)=="MT") ?

Screen Shot 2021-07-09 at 12 50 33 PM

LTLA commented

This depends on whether your location is a GRanges or GRangesList. For sce.416b, it's the latter, so the any() function will yield a vector (because the boolean ANY applies within each GRL entry, rather than across GRL entries). If you just have a GRanges, it's more appropriate to do which(); I believe that this is done for some of the other datasets.

Ideally, we would have a representation-agnostic way of getting this kind of vector, regardless of whether the input is a GR or GRL. I proposed this in Bioconductor/GenomicRanges#52 but it looks like there hasn't been much appetite for this.

Thanks!