Length of Bases in Overlapping Regions Calculated By BEDOPS
1
0
Entering edit mode
7.6 years ago
Apprentice ▴ 90

Hi, I have 2 bed files.

File 1: ref.bed

chr9    9383800    9493700    REGION


File 2: map.bed

chr9    9387448    9387482    PTPRD_EXON


I want to calculate a length of bases in an area overlapping between ref.bed and map.bed

So I used BEDOPS bedmap function as follows, and got the following result file.

$bedmap --echo --bases ref.bed map.bed > result.bed$ cat result.bed
chr9    9383800    9493700    REGION|34


Thus, this result file indicates that the length of bases in an overlapping area is "34bp".

However, I think the length might be incorrect.

Because, in this case, the overlapping area is chr9:9387448..9387482.

So, the length of overlapping area is 9387482-9387448+1 = "35bp".

Could you tell me whether my opinion is right?

bed • 1.4k views
2
Entering edit mode
7.6 years ago

BED files are zero-based. This means that the number of bases in a BED element is simply the difference of the stop and start coordinates. See: What Are The Advantages/Disadvantages Of One-Based Vs. Zero-Based Genome Coordinate Systems

0
Entering edit mode

I could learn very important point about BED file.

BEDOPS is very useful tool. I want to continue utilizing that.