When running the following code with ChIPpeakAnno package in R:
gr3 = GRanges(seqnames = c("chr1"), strand = c("+","+","+"), ranges = IRanges(start = c(1,3,5), width = 3))
gr3
> gr3
GRanges object with 3 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 [1, 3] +
[2] chr1 [3, 5] +
[3] chr1 [5, 7] +
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
gr4 = GRanges(seqnames = c("chr1"), strand = c("+","+","+","+"), ranges = IRanges(start = c(2,4,6,8), width = 3))
gr4
> gr4
GRanges object with 4 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 [2, 4] +
[2] chr1 [4, 6] +
[3] chr1 [6, 8] +
[4] chr1 [8, 10] +
-------
seqinfo: 1 sequence from an unspecified genome; no seqlengths
In gr4, the interval:
[4] chr1 [8, 10] +
doesn't intersect with intervals in gr3, so it's an interval of gr4 alone, but when we do:
ol1 <- findOverlapsOfPeaks(gr3, gr4)
ol1$venn_cnt
> ol1$venn_cnt
gr3 gr4 Counts
[1,] 0 0 0
[2,] 0 1 0
[3,] 1 0 0
[4,] 1 1 3
attr(,"class")
[1] "VennCounts"
there is no interval in gr4 alone (zero counts in 2nd row) When I do the same inverting the order:
ol2 <- findOverlapsOfPeaks(gr4, gr3)
ol2$venn_cnt
> ol2$venn_cnt
gr4 gr3 Counts
[1,] 0 0 0
[2,] 0 1 0
[3,] 1 0 0
[4,] 1 1 3
attr(,"class")
[1] "VennCounts"
the same happens.
Shouldn't there be 1 count for gr4 only? What am I interpreting wrong?