Mapping reads to references by PEAR, bowtie2, samtool idx and sort tools

1 2 3 4
1b_EU781828 9359 160810 84317
1b_EU781827 9413 103840 48024
1b_D90208 9413 37970 19835
1b_M58335 9416 36799 19551
1e_KC248194 9422 4518 2222

The above result is from samtool idx tool. Please tell me what they mean, thanks.

1, reference name; 2, genome size; 3, mapped reads; 4, unmapped reads?

Welcome, @huiping

This tool, like many others in Galaxy, is the same as would be used outside of Galaxy. That means the external documentation/usage is generally the same, especially for the outputs.

How to know where to find docs and examples?

  1. Internet search for references, publications, specifications.

  2. Scroll down on the tool form to find available references, including link-outs to author resources and publications.

Sometimes an abbreviated Help section will also be included as a short reference directly on the tool form. The content is usually from the original documentation. This is intended as a supplement and usually addresses any Galaxy-specific details like data formats. Most of what happens at this forum is connecting all of these together.

This is the Help section for this Samtools idx tool, which explains the output along with an example. Review the link-outs for full details.


What it does

Runs the samtools idxstats command. It retrieves and prints stats in the index file.

Input is a sorted and indexed BAM file, the output is tabular with four columns (one row per reference sequence plus a final line for unmapped reads):

Column Description

 1 Reference sequence identifier
 2 Reference sequence length
 3 Number of mapped reads
 4 Number of placed but unmapped reads
      (typically unmapped partners of mapped reads)

Example output from a de novo assembly:

contig_1 170035 98397 0
contig_2 403835 199564 0
contig_3 553102 288189 0
… … … …
contig_603 653 50 0
contig_604 214 6 0
* 0 0 50320
In this example there were 604 contigs, each with one line in the output table, plus the final row (labelled with an asterisk) representing 50320 unmapped reads. In this BAM file, the final column was otherwise zero.

The results of samtools ixdstats can be visualized with MultiQC.

Peter J.A. Cock (2013), Galaxy wrapper for the samtools idxstats command


Definition of SAM/BAM format. (n.d.). HTS format specifications

Visit Citation

Li, H., Handsaker, B., Wysoker, A., Fennell, T., Ruan, J., Homer, N., Marth, G., Abecasis, G., & Durbin, R. (2009). The Sequence Alignment/Map format and SAMtools. Bioinformatics, 25(16), 2078–2079. Sequence Alignment/Map format and SAMtools | Bioinformatics | Oxford Academic

Visit Citation

Li, H. (2011). Improving SNP discovery by base alignment quality. Bioinformatics, 27(8), 1157–1158. Improving SNP discovery by base alignment quality | Bioinformatics | Oxford Academic

Visit Citation

Li, H. (2011). A statistical framework for SNP calling, mutation discovery, association mapping and population genetical parameter estimation from sequencing data. Bioinformatics, 27(21), 2987–2993. statistical framework for SNP calling, mutation discovery, association mapping and population genetical parameter estimation from sequencing data | Bioinformatics | Oxford Academic

Visit Citation

Danecek. (n.d.). Multiallelic calling model in bcftools (-m).

Visit Citation

Durbin, R. (n.d.). Segregation based metric for variant call QC.

Visit Citation

Li, H. (n.d.). Mathematical Notes on SAMtools Algorithms.

Visit Citation

SAMTools GitHub page. (n.d.). GitHub - samtools/samtools: Tools (written in C using htslib) for manipulating next-generation sequencing data

Visit Citation

Requirements See details

  • samtools (Version 1.13)


Thanks, Jennifer.
I wonder what you mean by that unmapped partners of mapped reads?

Best regards,

Hi, Jennifer,

Below is the result from bowtie2 aligner using multi-fasta references. I wonder what the number in column 4 means? Thanks.




To better understand the difference between number of placed but unmapped reads versus the more general unmapped reads, maybe review the mapping statistics output by Bowtie2?

Both Samtools idxstats and Bowtie2 are generating statistics based on the BAM content (flags). The first is a higher level summary (and works on mapped BAM results generated by any (most?) tools) and the latter is a breakdown with more context specific to that tool.

You could also do some exploration with a tool like Filter BAM and other tools under the SAM/BAM tool group.