[Bioc-devel] 'droplevels' argument in `[` method for SummarizedExperiment?

Martin Morgan mtmorgan at fhcrc.org
Wed Mar 12 23:45:24 CET 2014

On 03/12/2014 03:02 PM, Wolfgang Huber wrote:
> Hi Martin, Mike
> a DESeq2 user brought up the observation that when he subsets a ‘DESeqDataSet’ object (the class inherits from ‘SummarizedExperiment’) by samples, he often ends up with unused factor levels in the colData. (Esp. since the subsetting is often to select certain subgroups). Would either of the following two make sense:
> - a ‘droplevels’ method for ‘SummarizedExperiment’ that efficiently and conveniently removes unused levels, i.e.
>       x = x[, x$tissue %in% c(“guts”, “brains”)]
>       x = droplevels(x)

vs. x$tissue = droplevels(x$tissue)

> - a ‘droplevels’ argument (default: FALSE)
>       x = x[, x$tissue %in% c(“guts”, “brains”), droplevels=TRUE]

there are a surprising number of places were levels could be dropped -- each 
column of colData, each column of (possibly two levels of) 'mcols' on the row 
data, and the seqlevels of the row data.

Does this make sense lower in the class hierarchy, e.g., Vector, as well as 


> Wolfgang
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

More information about the Bioc-devel mailing list