**70**wrote:

Hi everyone,

I have used the "findOverlaps" function in R to find which positions of my two datasets overlap. I have also used "countOverlaps" to see how many overlaps I have.

What I want to do now, is to find the exact coordinates which overlapped. I was looking how to do it using findOverlaps but it has no such options and by doing a google search, I couldn't find much help.

A little help on this would be greatly appreciated.

Thank you

**26k**• written 5.1 years ago by SGMS •

**70**

I have switched to

`foverlaps`

(`data.table`

package) whenever I working with genomic regions.A fast binary-search based overlap join of two data.tables. This is very much inspired by findOverlaps function from the bioconductor package IRanges...Simply intersect two data tables and extract overlapping region. Please post example data and I will show how it may be done.

32k• written 5.1 years ago by PoGibas ♦4.9kThank you for your reply Pgibas. Example data as required:

1st dataset:

2nd dataset:

Thanks again!

32k• written 5.1 years ago by SGMS •70What is the expected output? Do you want a new set of regions that represents the overlaps between dataset 1 and 2?

32k• written 5.1 years ago by Sean Davis ♦26kyes! exactly that!

70You datasets don't overlap.

32k• written 5.1 years ago by PoGibas ♦4.9kI personally use mergeByOverlaps and subsetByOverlaps for these cases.

27k