Right, what I was wondering however is whether it's possible not to create or modify the object at all, but rather access only the necessary bits.
It seems like a slightly different structure that puts all the location in one place (say @granges) and the metadata in another (as it presently is) might be handy to avoid this hoohah. That's rather a larger change. --t > On May 4, 2014, at 3:23 PM, "Johnston, Jeffrey" <j...@stowers.org> wrote: > > >> On May 4, 2014, at 3:50 PM, Tim Triche, Jr. <tim.tri...@gmail.com> wrote: >> >> I wanted something to extract @ranges from a GRanges object along with its >> @seqnames, @strand, and @seqinfo. Essentially, everything but the mcols. >> >> Does this make sense? Is there a lighter-weight way to avoid any copying >> in-flight? >> >> >> setMethod("granges", "GRanges", function(x) { >> GRanges(seqnames=seqnames(x), >> ranges=ranges(x), >> strand=strand(x), >> seqinfo=seqinfo(x)) >> }) >> >> >> The fact that I'm constructing an entire new GRanges makes me a little >> queasy... that said, it has turned out to be useful when I just want a >> short list of locations, as for debugging plotting functions, profile >> plots, or what have you. > > > Perhaps just this: > > setMethod("granges", "GRanges", function(x) { > mcols(x) <- NULL > x > }) > > > _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel