Bedtools tutorial
Help 7 / 20
bedtools intersect

Faster with sorted data

So far the examples presented have used the traditional algorithm in bedtools for finding intersections. It turns out, however, that bedtools is much faster when using presorted data.

For example, compare the difference in speed between the two approaches when finding intersections between exons.bed and hesc.chromHmm.bed:

time bedtools intersect -a gwas.bed -b hesc.chromHmm.bed > /dev/null
time bedtools intersect -a gwas.bed -b hesc.chromHmm.bed -sorted > /dev/null

Performance gains due to using sorted data increase as the number of BAM alignments increases

Loading...