intersectBed - multiple intersections
Hi, all!
I have two bed files to find common SNP's between them.
$ cat targets.bed
chr15 2462 2462 DNMT1-1
chr15 2463 2463 DNMT1-2
$ cat sample.33.bed
chr15 2461 2461 Idx.Pr.33
chr15 2462 2462 Idx.Pr.33
I expected the overlap at '2462'
chr15 2462 2462 DNMT1-1 chr15 2462 2462 Idx.Pr.33
instead I had three over laps
$ intersectBed -wa -wb -loj -a targets.bed -b sample.33.bed
chr15 2462 2462 DNMT1-1 chr15 2461 2461 Idx.Pr.33
chr15 2462 2462 DNMT1-1 chr15 2462 2462 Idx.Pr.33
chr15 2463 2463 DNMT1-2 chr15 2462 2462 Idx.Pr.33
I think this reuslt was caused because the bedtools uses 0-based coordinate system.
How can I solve this problem?
Thank you!
• 2,319 views
•
link
2 answers
Just like you doubted, please make both the bed files in proper bed format and then do intersect. This link may help you with the co-ordinates systems. It has nice illustrations.
Still, the result would have non overlapping entry like below since -loj option is used
chr15 2461 2462 DNMT1-1 chr15 2461 2462 Idx.Pr.33
chr15 2462 2463 DNMT1-2 . -1 -1 .
• 0 views
•
link
The following command report only those intersections where 100% of the query record is overlapped
bedtools intersect -wa -wb -a targets.bed -b sample.33.bed -sorted -f 1.0
• 0 views
•
link
Log in to answer this question.
BED uses coordinates in a half-open interval, so if you are using a BED file to define the position of a base in a SNP, the start position should be one less than the stop position (or the stop position one more than the start, depending on your original coordinate system).