I'm confused about the default behavior of bedtools closest
. I ran the command bedtools closest -a a.bed -b b.bed -k 1 > closest.bed
and got this as a part of the output (the columns correspond to chrom, start in a.bed
and chrom, start in b.bed
):
9 5819608 9 5819608
9 5819608 9 6080573
9 5819608 9 6164857
9 5819608 9 6278938
9 5819608 9 6506183
9 5819608 9 6507818
9 5819608 9 6832603
9 5819608 9 6957619
9 5819608 9 7010222
However, the only region in a.bed
this corresponds to is (the columns correspond to chrom, start, end):
9 5819608 8043573
and the only segments in b.bed
that are relevant are (the columns correspond to chrom, start, end):
9 5086998 5326535
9 5326536 5819607
9 5819608 6080572
9 6080573 6164856
9 6164857 6278937
9 6278938 6506182
9 6506183 6507817
9 6507818 6832602
9 6832603 6957618
9 6957619 7010221
9 7010222 8043572
But it was my understanding that, for default behavior, bedtools closest
only reports multiple regions in b.bed
if there is a tie. However, I don't see a tie here; the only closest regions should be the first and last regions of the segments posted in b.bed
, no?