Chromosome-wise read statistics (mapped & unmapped).
samtools idxstats
samtools idxstats provides alignment statistics
for each reference sequence (chromosome, contig, scaffold, etc.)
present in an indexed BAM or CRAM file. It reports the number
of mapped and unmapped reads associated with each reference,
allowing users to quickly assess sequencing coverage and read
distribution across the genome.
.bam)
.cram)
samtools index.
# Generate idxstats report
samtools idxstats sample.bam
# Save output to file
samtools idxstats sample.bam > idxstats.txt
# Run on CRAM file
samtools idxstats sample.cram
chr1 248956422 1256789 1254
chr2 242193529 1185423 1102
chr3 198295559 1056321 986
* 0 0 4521
The output shows the chromosome name, chromosome length,
number of mapped reads, and number of unmapped reads.
The * row summarizes reads that are not
assigned to any reference sequence.
Official Samtools Documentation: Samtools Idxstats Manual
Li, H., Handsaker, B., Wysoker, A., Fennell, T., Ruan, J., Homer, N., et al. (2009). The Sequence Alignment/Map (SAM) format and SAMtools. Bioinformatics, 25(16), 2078–2079. DOI: 10.1093/bioinformatics/btp352