[BioC] c()ombining G/IRanges with elementMetadata: feature inquiry/request

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Feb 7 18:42:31 CET 2011


Hi all,

Would anyone else find it useful to have something like an
".ignoreValues" argument in the `c`ombine functions for G/IRanges so
that you could easily combine several *Ranges objects that have
different elementMetadata.

For instance:

R> library(GenomicRanges)
R> gr.1 <- GRanges('chr1', IRanges(c(1, 10, 30), width=5), '*', score=rnorm(3))
R> gr.2 <- GRanges('chr2', IRanges(c(20, 50, 100), width=10), '*',
annotation=c('a', 'b', 'c'))

Now say I want to combine them:

R> c(gr.1, gr.2)
Error in .Method(..., deparse.level = deparse.level) :
  column names for arg 2 do not match those of first arg

It makes sense to error on that, since I'm losing information by
combining the two, but suppose that I know I'm going to lose
information but want to combine them anyway, I have to:

R> values(gr.1) <- NULL
R> values(gr.2) <- NULL
R> c(gr.1, gr.2)

Which would work, but if I didn't want to lose my elementMetadata, I'd
 make temp vars for gr.1 and gr.2 and set their values() to NULL then
combine the two (three, four, etc.)

But what if something like this was kosher:

R> c(gr.1, gr.2, .ignoreValues=TRUE)

and returned the combination of the "range" information of the desired
objects, with a NULL DataFrame for its elementMetadata?

Looking at the source for the I/GRanges "c" functions, it looks like a
pretty easy change to make, but perhaps it's not worth adding an extra
parameter if others wouldn't find it useful.

... just ruminating some ...

Thanks,

-steve
-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list