samtools-index(1)
π¦ NAME π¦
Okay bestie, this is the samtools-index(1) page, and it's literally about how samtools index indexes SAM/BAM/CRAM files. That's the whole assignment. π
β¨ SYNOPSIS β¨
samtools index -M [-bc] [-m INT] FILE FILE [FILE...]
samtools index [-bc] [-m INT] aln.sam|aln.bam|aln.cram [out.index]
π DESCRIPTION π
So here's the tea: you use this to index coordinate-sorted BGZIP-compressed SAM, BAM or CRAM files so they get fast random access. β¨
SAM girlies listen up: for SAM this only works if the file has been BGZF compressed first. No cap. π«Ά
Also, the first synopsis with multiple input FILEs? That's only available with Samtools 1.16 or later. iykyk.
Why do you even want this index? Because when region arguments are used to limit samtools view and similar commands to particular regions of interest, this index is needed. Periodt.
When only one alignment file is being indexed, the output index filename can be specified via -o or as shown in the second synopsis. Cute, right? π
When no output filename is specified, here's the file-name lore:
- for a CRAM file
aln.cram, index filealn.cram.craiwill be created; - for a BAM file
aln.bam, eitheraln.bam.baioraln.bam.csiwill be created; - and for a compressed SAM file
aln.sam.gz, eitheraln.sam.gz.baioraln.sam.gz.csiwill be created β with the.baivs.csichoice depending on the index format selected.
Now the important size warning: the BAI index format can handle individual chromosomes up to 512 Mbp (2^29 bases) in length. If your input file might contain reads mapped to positions greater than that, you will need to use a CSI index. Not optional, bestie. π
πΈ OPTIONS πΈ
-b,--baiβ create a BAI index. This is currently the default when no format options are used. π-c,--csiβ create a CSI index. By default, the minimum interval size for the index is2^14, which is the same as the fixed value used by the BAI format. β¨-m,--min-shift INTβ create a CSI index, with a minimum interval size of2^INT. π§-Mβ interpret all filename arguments as alignment files to be indexed individually. (Without-M, filename arguments are interpreted solely as per the second synopsis.) π-o,--output FILEβ write the output index toFILE. (Currently may only be used when exactly one alignment file is being indexed.) π-@,--threads INTβ number of input/output compression threads to use in addition to main thread[0]. π₯
π AUTHOR π
Written by Heng Li from the Sanger Institute. Iconic. π
π¦ SEE ALSO π¦
Samtools website: <http://www.htslib.org/> π
okay bye bestie π β this was samtools-1.24, dated 9 July 2026. samtools-index(1), out! π«Ά
π¦ where this page comes from
- epel 10: samtools 1.24-2.el10_3 Β· MIT
- nixpkgs unstable: samtools 1.24
- Copyright (C) 2008-2011, 2013-2020 Genome Research Ltd
- copyright (C) 2010, 2011 Broad Institute
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms