[BioC] GRanges - reduce() function
Martin Morgan
mtmorgan at fhcrc.org
Fri Nov 18 15:12:31 CET 2011
On 11/17/2011 05:57 PM, Jason Ross wrote:
> Hi Fahim,
>
> I am also frustrated by this. The meta-data also vanishes when using
> findOverlaps(). I'm thinking of writing some wrapper functions to place the
> meta-data back into the Granges object.
Hi Jason et al.,
The problem in 'reduce' is that the elementMetadata columns need to be
'reduce'd too, and there is no universal way to do that -- for
'transcripts' in Fahim's example, maybe it's just collapsing entries
into a CharacterList, whereas for "Gene" it's split-by-reduced-range and
'unique'. For numeric values one might sum or mean or max or ....
Can you be more specific about findOverlaps? It's not really clear which
data you'd like to have propagated.
For Fahim's question, I arrived at
values(r)[["Gene"]] <-
tapply(values(gr)[["Gene"]], match(gr, r), unique)
which I think is quite robust, but I'd recommend checking carefully on
complicated data.
Martin
>
> Regards,
> Jason.
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
Location: M1-B861
Telephone: 206 667-2793
More information about the Bioconductor
mailing list