One approach: Combine the ranges into a single RangedData, with a factor tracking their source. Then do a findOverlaps, asking for all overlaps. Get the source from the subject indices and call table() with the indices in A and the source variable. Then you have something like:
A index B C D 1 2 3 0 2 1 2 1 3 0 5 2 Etc. Then just do rowSums(tab > 0) == 3 to see which hit all three sources. Michael On Tue, Mar 16, 2010 at 1:55 PM, Ivan Gregoretti <[email protected]> wrote: > Hi Michael, > > I think that I expressed myself too ambiguously. > > I am looking for the multiple intersection. That is, I am looking for > the ranges in A that are even minimally overlapped by ranges in ALL > the rest of the RangesData instances. A super-dee-duper intersection. > > The union() operation would be finding overlaps with ANY of the rest > of the RangesData. > > At the moment, like Karl, I am evading the problem by dint of shameful > for loops. > > Do you think that there is a more elegant way? > > Thanks > > Ivan > > > Ivan Gregoretti, PhD > National Institute of Diabetes and Digestive and Kidney Diseases > National Institutes of Health > 5 Memorial Dr, Building 5, Room 205. > Bethesda, MD 20892. USA. > Phone: 1-301-496-1592 > Fax: 1-301-496-9878 > > > > On Tue, Mar 16, 2010 at 4:26 PM, Michael Lawrence > <[email protected]> wrote: > > > > > > On Tue, Mar 16, 2010 at 12:34 PM, Ivan Gregoretti <[email protected]> > > wrote: > >> > >> Hello everybody, > >> > >> Say A, B, C, D, .... are all RangedData instances. > >> > >> How do you come up with the list of ranges in A that have at least > >> some overlap with B, C, D, ...? > >> > >> I want to calculate the multiple intersection ignoring the extent of > >> the overlap. > >> > >> ?findOverlaps does not hint how to recover the ranges from A. > >> > > > > Something like: > > ranges(A) %in% union(union(ranges(B), ranges(C)), ranges(D)) > > > > That syntax is a little verbose. I propose adding some operators to > Ranges, > > RangesList and RangedData objects. > > > > "+" for union() > > "-" for setdiff() > > "!" for gaps() > > > > Then we could have: > > A %in% (B + C + D) > > > > What do people think? > > > > > >> > >> Thank you, > >> > >> Ivan > >> > >> > >> Ivan Gregoretti, PhD > >> National Institute of Diabetes and Digestive and Kidney Diseases > >> National Institutes of Health > >> 5 Memorial Dr, Building 5, Room 205. > >> Bethesda, MD 20892. USA. > >> Phone: 1-301-496-1592 > >> Fax: 1-301-496-9878 > >> > >> _______________________________________________ > >> 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
