Ron,

Thanks for the positive feedback!

The function findOverlappingPeaks output additional two RangedData sets, Peaks1withOverlaps and Peaks2withOverlaps. You can use the following code snippet to obtain the peaks from peaks1 that do not overlap with those from peaks2 and vice versa.

peaks1 = RangedData(IRanges(start=c(1543200,1557200,1563000,1569800,167889600,300),end=c(1555199,1560599,1565199,1573799,167893599,500),names=c("p1","p2","p3","p4","p5","p6")),strand=as.character("+"),space=c(6,6,6,6,5,7))
 peaks2 =  RangedData(IRanges(start=c(1549800,1554400,1565000,1569400,167888600),end=c(1550599,1560799,1565399,1571199,167888999),names=c("f1","f2","f3","f4","f5")),strand= as.character("+"),space=c(6,6,6,6,5))
   t1 =findOverlappingPeaks(peaks1, peaks2, maxgap=1000, multiple=F,NameOfPeaks1="TF1", NameOfPeaks2="TF2")
peaks1withOverlap = t1$Peaks1withOverlaps

peaks1[ !rownames(peaks1) %in% rownames(peaks1withOverlap),]

peaks2withOverlap = t1$Peaks2withOverlaps

peaks2[ !rownames(peaks2) %in% rownames(peaks2withOverlap),]


Best regards,

Julie

On 1/14/11 3:24 PM, "Ron Hart" <rhart@rci.rutgers.edu> wrote:

Julie,

First off, thanks very much for providing the ChIPpeakAnno package in R!  We’ve found it to be enormously useful and reasonably easy to use (for us R neophytes)!

I have one question for you.  I started to play with the findOverlappingPeaks() function and I was wondering if you’d considered creating a similar function to generate intersections instead of unions.  In my case I want to know which subset of peaks from condition #1 that do not overlap with those from condition #2. Or those in #2 that don’t overlap with #1.

It sounds to me as if I should be able to replace the findOverlaps() function within your function with something like intersect() but I don’t think there is a version of intersect() specifically for ranged data.  Would this be difficult to create by modifying your function?

Thanks,

Ron


Ron Hart rhart@rci.rutgers.edu <mailto:rhart@rci.rutgers.edu>
W.M. Keck Center for Collaborative Neuroscience <http://keck.rutgers.edu/> ,
Department of Cell Biology & Neuroscience <http://cbn.rutgers.edu/> ,
and Rutgers Stem Cell Research Center <http://scrc.rutgers.edu/>
Rutgers University




	[[alternative HTML version deleted]]

