I am a newbie in R language and need help with some suggestions for the following script I am working on.
So, the script checks if the genomic coordinate from BEDPE file1 (it has other info as well) are within a specific range of the genomic coordinates from another BEDPE file2. I want to merge the two data frames in to one if the file1 genome coordinates are within 150 bps upstream or downstream of the genome coordinates in the file2, I am comparing with. Is there any R function which can be used here to get what I want?
The output should be the genomic coordinates from first file which are within the range of second file.
So far I have tried merge and using by= "colname" but that does not allow the intersection within a range. It gives the output if the coordinates are matching exactly.
I forgot to mention, I am using BEDPE files.
Any help would be appreciated. Thanks!