Sometimes we need to map reads to a multi-fasta reference with lots of sequences, e.g. to screen for large sets of genes or plasmids. The mapping works fine, but it can be tricksy to get alignment statistics (such as % of reads mapped) broken down by reference sequence, using common tools like Samtools, Bamtools or Bamstats.
Getting the statistics is easy:
sam-stats -A -B aln.bam > aln-stats.txt
(The ‘A’ option turns on reporting for all ‘chromosomes’, whilst ‘B’ tell the program the file is a BAM)
The details of the output can be found on the sam-stats wiki page. There you can also find more options for statistics, as well as utilities for removing adapter sequences and de-multiplexing fastqs.