Maybe something like: m <- findOverlaps(x,y) xhits <- x[queryHits(m)] yhits <- y[subjectHits(m)]
mint <- pintersect(xhits, yhits) xpercent <- width(mint) / width(x) ypercent <- width(mint) / width(y) On Tue, Sep 7, 2010 at 10:27 AM, Kunbin Qu <[email protected]> wrote: > Hi, > > I have some IRanges like the followings. I would like to find out the > overlap of x and y, and also the actual overlap percentage to each when > they overlap. For the following case, IRanges 3 in x overlaps with > IRanges 2 in y from 8 -9. Is there a function to call to give me the > overlap% for x and y, which are 2/3 = 67% for x, 2/4 = 50% for y? thanks > a lot! > > -Kunbin > > > > x > IRanges of length 3 > start end width > [1] 1 2 2 > [2] 5 6 2 > [3] 7 9 3 > > y > IRanges of length 2 > start end width > [1] 3 4 2 > [2] 8 11 4 > > findOverlaps(x,y) > An object of class "RangesMatching" > Slot "matchMatrix": > query subject > [1,] 3 2 > > Slot "DIM": > [1] 3 2 > > > > > ______________________________________________________________________ > The contents of this electronic message, including any attachments, are > intended only for the use of the individual or entity to which they are > addressed and may contain confidential information. If you are not the > intended recipient, you are hereby notified that any use, dissemination, > distribution, or copying of this message or any attachment is strictly > prohibited. If you have received this transmission in error, please send an > e-mail to [email protected] and delete this message, along with > any attachments, from your computer. > > _______________________________________________ > Bioc-sig-sequencing mailing list > [email protected] > https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing > [[alternative HTML version deleted]] _______________________________________________ Bioc-sig-sequencing mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
