samtools
Tools for handling high-throughput sequencing (genomics) data. Used for reading/writing/editing/indexing/viewing of data in SAM/BAM/CRAM format.
More info →Options (3)
-b, --bambooleanConvert a SAM input file to BAM stream and save to file
samtools view -S {{[-b|--bam]}} {{input.sam}} > {{output.bam}}-h, --with-headerbooleanTake input from `stdin` (-) and print the SAM header and any reads overlapping a specific region to `stdout`
{{other_command}} | samtools view {{[-h|--with-header]}} - chromosome:start-end-o, --outputbooleanSort file and save to BAM (the output format is automatically determined from the output file's extension)
samtools sort {{input}} {{[-o|--output]}} {{output.bam}}Examples (8)
Convert a SAM input file to BAM stream and save to file
Take input from `stdin` (-) and print the SAM header and any reads overlapping a specific region to `stdout`
Sort file and save to BAM (the output format is automatically determined from the output file's extension)
Index a sorted BAM file (creates `sorted_input.bam.bai`)
samtools index sorted_input.bamPrint alignment statistics about a file
samtools flagstat sorted_inputCount alignments to each index (chromosome/contig)
samtools idxstats sorted_indexed_inputMerge multiple files
samtools merge output input1 input2 ...