jianhong / ChIPpeakAnno

11 stars 4 forks source link

Differences between bedtools overlap / findOverlaps and findOverlapsOfPeaks #18

Open csijcs opened 2 years ago

csijcs commented 2 years ago

Thanks for the great tool!

I'm a bit unclear why there is a difference between the number of overlapping peaks found by bedtools overlap and findOverlaps (which find the exact same number of overlapping peaks), and that of findOverlapsOfPeaks, which seems to with miss a few of the peaks or filter them out. I am just running the functions with default parameters. I have tried altering the connectedPeaks parameter, but still get the same number of overlapping peaks. Can you tell me why there are missing peaks and how I can recover them?

jianhong commented 2 years ago

@csijcs Thank you for trying ChIPpeakAnno to annotate your data. I have trouble in understanding your question. Could you please show me the sample to explain your question? Here may be something you want read: https://bioconductor.org/packages/release/bioc/vignettes/ChIPpeakAnno/inst/doc/FAQs.html#Find_Overlaps_of_Peaks

csijcs commented 2 years ago

Intersecting with bedtools: $ bedtools intersect -a file1.bed -b file2.bed | wc -l 1962

Using findOverlaps: > findOverlaps(file1,file2) Hits object with 1962 hits and 0 metadata columns:

Using findOverlapsOfPeaks: > findOverlapsOfPeaks(file1,file2)$venn_cnt[4,3] Counts 1956

jianhong commented 2 years ago

Could you share the image by following codes:

ol <- findOverlapsOfPeaks(file1,file2, connectedPeaks='keepAll')
makeVennDiagram(ol)
csijcs commented 2 years ago

test.pdf

jianhong commented 2 years ago

sorry, I forget the parameters for venndiagram makeVennDiagram(ol, connectedPeaks='keepAll')

csijcs commented 2 years ago

test.pdf

jianhong commented 2 years ago

now try to run

ol <- findOverlaps(file1,file2)
length(unique(queryHits(ol)))
length(unique(subjectHits(ol)))

and share me the number

csijcs commented 2 years ago
> length(unique(queryHits(ol)))
[1] 1961
> length(unique(subjectHits(ol)))
[1] 1957
jianhong commented 2 years ago

I think you figure it out the difference. Let me know if you still have any questions.

csijcs commented 2 years ago

Got it, thanks!