Question: Extract exact match from bed files
0
gravatar for brown.annaleigh
5 weeks ago by
brown.annaleigh10 wrote:

I would like to extract only regions which exactly match another bed

So I have a regions of interest bed which defines regions, I want to extract only exact matches to these regions

cat regions_of_interest.bed
chr8    79611214    79636802    annotated   0   -
chr8    79611214    79616823    abnormal    0   -

Trying with bedops extracts the regions which also have overlap with these regions

bedops -e 1 target.sorted.bed regions_of_interest.bed

Returns

chr8    79611214    79613670    target.sorted.bed   3   +
chr8    79611214    79613823    target.sorted.bed   178 +
chr8    79611214    79615702    target.sorted.bed   3   +
chr8    79611214    79616054    target.sorted.bed   6   +

Bedtools intersect also returns any overlap

bedtools intersect -a target.sorted.bed -b regions_of_interest.bed

chr8    79611214    79613670    target.sorted.bed   3   +
chr8    79611214    79613670    target.sorted.bed   3   +
chr8    79611214    79613823    target.sorted.bed   178 +
chr8    79611214    79613823    target.sorted.bed   178 +
chr8    79611214    79615702    target.sorted.bed   3   +
chr8    79611214    79615702    target.sorted.bed   3   +
chr8    79611214    79616054    target.sorted.bed   6   +
chr8    79611214    79616054    target.sorted.bed   6   +

Ideally the function would work like this

differenttool intersect -a target.sorted.bed -b regions_of_interest.bed

chr8    79611214    79613823    target.sorted.bed   178 +
chr8    79611214    79636802    target.sorted.bed   2996    +
bedops bed bedtools • 133 views
ADD COMMENTlink modified 5 weeks ago by Alex Reynolds30k • written 5 weeks ago by brown.annaleigh10
1
gravatar for brown.annaleigh
5 weeks ago by
brown.annaleigh10 wrote:
bedtools intersect -f 1 -wa -r -a target.aggregated.bed -b regions_of_interest.bed
ADD COMMENTlink modified 5 weeks ago by genomax89k • written 5 weeks ago by brown.annaleigh10
1
gravatar for Alex Reynolds
5 weeks ago by
Alex Reynolds30k
Seattle, WA USA
Alex Reynolds30k wrote:

The following uses BEDOPS bedmap:

bedmap --echo --exact --skip-unmapped target.sorted.bed regions_of_interest.bed > answer.bed

The file answer.bed contains elements from target.sorted.bed, whose intervals match exactly with intervals from regions_of_interest.bed.

ADD COMMENTlink modified 5 weeks ago • written 5 weeks ago by Alex Reynolds30k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1502 users visited in the last hour