On Wed, Mar 12, 2014 at 3:45 PM, Martin Morgan <mtmor...@fhcrc.org> wrote:
> 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) > > > This seems preferable. > - 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 GRanges/List? > > For something fundamental like Rle, it's probably best/simplest to just call droplevels explicitly after extraction. For more complex data structures, I'm not sure there is really a use-case where the user would want to drop levels on everything. Probably best to be explicit. > Martin > > > >> Wolfgang >> >> _______________________________________________ >> Bioc-devel@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 > > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel > [[alternative HTML version deleted]] _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel