This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I find to which regions and chromosomes in a bed file does a chromosome in another file map to?

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?

bed r perl bedtools

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.