Crystal implementation of bam-filter by Brent Pedersen.
Filter BAM / CRAM / SAM files with a simple expression language.
git clone https://github.com/bio-cr/bam-filter
make
sudo make install
- Ubuntu 20.04 and 22.04: deb packages are available from the Github release page.
- Please note that installing the bam-filter deb package may uninstall packages that depend on
libcurl4-openssl-dev
, sincelibhts-dev
depends onlibcurl4-gnutls-dev
.
- Please note that installing the bam-filter deb package may uninstall packages that depend on
- Currently only Linux is supported. Pull requests are welcome.
Usage: bam-filter [options] <bam_file>
-e, --expression EXPR eval code
-o, --output PATH Write output to FILE [standard output]
-f, --fasta FASTA Reference sequence FASTA FILE [null]
-S, --sam Output SAM
-b, --bam Output BAM
-C, --cram Output CRAM (requires -f)
-t, --threads NUM Number of threads to use [0]
--no-PG Do not add @PG line to the header
-h, --help Show this help
-v, --version Show version number
Example
bam-filter -S -e "chr=='chr1' && pos > 200 && tag_AS > 35" test/moo.bam
The given expression is evaluated by klib/kexpr.
Fields: name
flag
chr
pos
start
stop
mapq
mchr
mpos
isize
Flags: paired
proper_pair
unmapped
mate_unmapped
reverse
mate_reverse
read1
read2
secondary
qcfail
duplicate
supplementary
Tags: tag_XX
(XX is aux tag)
The easiest way to start development is to use Gitpod. All you need is a browser.
Bug fixes and macOS support are welcome.
bam-filter was originally created to develop and test HTS.cr.