On Mon, Feb 7, 2011 at 9:42 AM, Steve Lianoglou <
mailinglist.honeypot@gmail.com> wrote:

> 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)
>
>
Pretty good idea. Might name that parameter .ignoreElementMetadata. Longer,
yes, but ignoreValues just sounds too generic. Also realize that these
objects have a "metadata" slot in addition to elementMetadata. Not sure how
that is currently combined/handled.

Another addition could be a function that drops the metadata, just how
unname drops the names of something.

Then: c(dropMetadata(gr.1), dropMetadata(gr.2))

But yea, your idea for 'c' is convenient. Care to submit a patch?

Thanks,
Michael

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
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

