I have two bed files, first one was the input.bed, second one is produced by mapping to the first one. Lets call it output.bed.
In my case I have one to many mapping , for instance a row input.bed maps to multiple regions in output.bed
How can I identify this(which rows) using r or perl?
Is bed tools helpful in this instance?
1 answer
BEDOPS bedmap is an option, e.g.:
$ bedmap --echo --echo-map reference.bed map.bed > answer.bed
The file answer.bed will contain all elements from reference.bed on each line, with any elements from map.bed that overlap elements from reference.bed.
You can add options to change delimiters or overlap criteria, as well as apply signal or ID mapping operations, etc.
The BEDOPS documentation has more detail:
http://bedops.readthedocs.io/en/latest/content/reference/statistics/bedmap.html
Note: Someone has suggested using bedops --intersect. This answer is not correct, as --intersect calculates new genomic regions where there are overlaps in the genomic intervals in two or more sets, i.e. an intersection.
If you want to map or find associations between two sets, use bedmap to retrieve those associations (or use bedops --element-of, if you do not need to preserve per-element associations, but simply want to see what elements in one set overlap those in another set).
Log in to answer this question.
Take a look at bedtools intersect. Equivalent option in BEDOPS.