# compile and install
git clone https://github.com/lh3/bedtk
cd bedtk && make
# filter a BED or VCF file
./bedtk flt test/test-anno.bed.gz test/test-iso.bed.gz
./bedtk flt -v test/test-anno.bed.gz test/test-iso.bed.gz # non-overlapping lines
./bedtk flt -cw100 test/test-anno.bed.gz test/test-sub.vcf.gz # with a window
# intersect (no sorting needed; overlapping records allowed)
./bedtk isec test/test-anno.bed.gz test/test-iso.bed.gz
# compute the breadth of coverage
./bedtk cov test/test-anno.bed.gz test/test-iso.bed.gz
# sort a BED file
./bedtk sort test/test-iso.bed.gz
./bedtk sort -s test/chr_list.txt test/test-iso.bed.gz
# merge overlapping records (no sorting needed)
./bedtk merge test/test-anno.bed.gz
Bedtk is a set of simple tools to process BED files. It so far implements intersection, subtraction, sorting, merging and computing the breadth of coverage. Bedtk is not as versatile as bedtools and never aims to match the bedtools feature set. It instead focuses on performance. Bedtk is several to tens of times faster and uses a fraction of memory. It also provides a few convenient functions. For example, sorting, merging and intersection can be done in one go without Unix pipes.
Bedtk is published in:
Li H and Rong J (2021) Bedtk: finding interval overlap with implicit interval tree. Bioinformatics, 37:1315-1316