BamStats reports clipping stats, flag stats, insert size and mapping quality on a BAM file. It outputs a JSON file, but can optionally also output in TSV format.


BamStats requires Java 8 to be installed on your device. Download Java 8 here or install via your distribution's package manager.

Download the latest version of BamStats here. To generate the usage run:

java -jar <BamStats_jar> --help


BamStats requires a BAM file and an output directory for its stats. Optionally a reference fasta file can be added against which the BAM file will be validated. There are also fllags to set the binsize of stats, the size of the region per thread, and whether to also output in TSV format.


To validate file.bam:

java -jar <BamStats_jar> \
-b file.bam \
-o output_dir

To validate file.bam to reference.fa and output the result also as TSV, while setting bin size and thread bin size to 200:

java -jar <BamStats_jar> \
-R reference.fa \
-o output_dir \
-b file.bam \
--binSize 200 \
--threadBinSize 200 \


Usage for BamStats:

Option Required Can occur multiple times Description
--log_level, -l no no Level of log information printed. Possible levels: 'debug', 'info', 'warn', 'error'
--help, -h no no Print usage
--version, -v no no Print version
--reference, -R no no Fasta file of reference
--outputDir, -o yes no Output directory
--bam, -b yes no Input bam file
--binSize no no Bin size of stats (beta)
--threadBinSize no no Size of region per thread
--tsvOutputs no no Also output tsv files, default there is only a json


BamStats is part of BIOPET tool suite that is developed at LUMC by the SASC team. Each tool in the BIOPET tool suite is meant to offer a standalone function that can be used to perform a dedicate data analysis task or added as part of BIOPET pipelines.

All tools in the BIOPET tool suite are Free/Libre and Open Source Software.


The source code of BamStats can be found here. We welcome any contributions. Bug reports, feature requests and feedback can be submitted at our issue tracker.

BamStats is build using sbt. Before submitting a pull request, make sure all tests can be passed by running sbt test from the project's root. We recommend using an IDE to work on BamStats. We have had good results with this IDE.


For any question related to BamStats, please use the github issue tracker or contact the SASC team directly at: