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 installUsage: 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)
Bug fixes and macOS support are welcome.
bam-filter was originally created to develop and test HTS.cr.