[Bioc-devel] mapping between original and reduced ranges
Hahne, Florian
florian.hahne at novartis.com
Wed Mar 14 20:22:15 CET 2012
This bounced before, guess the mailing list does not like HTML mails. So
one more try:
I had the following offline discussion with Michael about how one could
retain a mapping of the ranges in a GRanges object before and after
reduce. He suggested to take it to the list. Is that something that could
be added to GenomicRanges/IRanges?
Florian
I have a slightly tricky application for which I need to reduce a GRanges
object, but I would like to be able to process some of the original
elementMetadata of the merged ranges later. The only way I was able to
figure out which of the original ranges correspond to the merged ranges
was to perform a findOverlaps operation, but of course that is rather
costly. Is there a way to get the merge information out of the original
reduce call?
Here is a brief example:
gr <- GRanges(seqnames="chr1", ranges=IRanges(start=c(1,6,12,24,27),
width=5), foo=1:5, bar=letters[1:5])
gr2 <- reduce(gr, min.gapwidth=1)
ind <- queryHits(findOverlaps(gr2, gr))
split(values(gr), ind)
Unfortunately, this is the idiom. I could see an improvement where reduce
or a similarly named function would return a Hits object (in addition to
the actual reduce result) that would indicate the mapping between the
input and reduced ranges. The RangesMapping structure would be really
close to what we would need.
Michael
More information about the Bioc-devel
mailing list