Bioconductor / OrchestratingSingleCellAnalysis

Content for the OSCA Book.
http://bioconductor.org/books/devel/OSCA/
64 stars 37 forks source link

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

Closed tiagochst closed 3 years ago

tiagochst commented 3 years ago

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 3 years ago

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.

tiagochst commented 3 years ago

Thanks!