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!
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).