samtools-faidx(1)
π samtools-faidx β index or query regions from a fasta file
okay so real talk, bestie: this little icon is part of the samtools family (you know, the bioinformatics tools squad), and it's genuinely one of the most useful things ever. It's called samtools-faidx, and it does two whole jobs. Let's get into it π«Ά
β¨ NAME β¨
samtools faidx β indexes your fasta file, or pulls regions out of one that's already indexed π
π¦ SYNOPSIS π¦
samtools faidx ref.fasta [region1 [...]]
πΈ DESCRIPTION πΈ
So basically, samtools faidx indexes a reference sequence in the FASTA format, or it extracts a subsequence from a reference sequence that's already been indexed. Two moods, one command, we love that for us β¨
If you don't give it any region at all, faidx will index the file and create <ref.fasta>.fai on your disk. That's it. That's the whole vibe.
But if you do pass regions? Then the subsequences get retrieved and printed to stdout in the FASTA format. Lowkey the best party trick π
The input and the output can both be files compressed in the BGZF format. And when the output is compressed, the default compression level is 4 β noted, no cap.
π Important, bestie: the sequences in the input file should all have different names. If they don't, indexing will emit a warning about duplicate sequences, and retrieval will only produce subsequences from the first sequence with the duplicated name. So likeβ¦ name your sequences properly, iykyk.
FASTQ files can also be read and indexed by this command β iconic, flexible, we stan. Just remember: without using --fastq, any extracted subsequence will be in FASTA format.
π OPTIONS π
-o,--outputFILE β Write the FASTA to a file instead of to stdout. And if FILE ends with.gz,.bgzor.bgzf? Boom, it gets BGZF compressed automatically π-n,--lengthINT β Length for FASTA sequence line wrapping. If it's zero, that means do not line wrap. Defaults to the line length in the input file.-c,--continueβ Continue working even if a non-existent region is requested. She persists. She does not give up π€-r,--region-fileFILE β Read regions from a file. The format ischr:from-to, one per line. Clean, simple, organized π-f,--fastqβ Read FASTQ files and output extracted sequences in FASTQ format. This is the same as usingsamtools fqidx.-i,--reverse-complementβ Output the sequence as the reverse complement. When this option is used, β/rcβ will be appended to the sequence names. To turn this off or change the string appended, use the--mark-strandoption. (Yes, she labels her work, main character energy π)--mark-strandTYPE β Append a strand indicator to the sequence name. TYPE can be one of these:rcβ Append'/rc'when writing the reverse complement. This is the default.noβ Do not append anything. Minimalist. Respect.signβ Append'(+)'for the forward strand or'(-)'for the reverse complement. This matches the output of βbedtools getfasta -sβ π§custom,<pos>,<neg>β Append the string <pos> to names when writing the forward strand and <neg> when writing the reverse strand. Spaces are preserved, so it's totally possible to move the indicator into the comment part of the description line by including a leading space in the strings <pos> and <neg>. Fancy, I know π
--fai-idxFILE β Read/Write to the specified index file.--gzi-idxFILE β Read/Write to the specified compressed file index (used with.gzfiles).-h,--helpβ Print the help message and exit. The classic.--output-fmt-optionOPT=VAL β Set the output format options, e.g.level=0..9for compression level 0 to 9 π--write-indexβ Create an index for the output sequence data along with the output, in the same path as<output name>.faiand<outputname>.gzi. Heads up bestie: this option is valid only for file output. Stdout girlies, this one's not for you π-@,--threadsN β Set the number of extra threads for operations on compressed files. Go faster, slay faster π₯
π AUTHOR π
Written by Heng Li, with modifications by Andrew Whitwham and Robert Davies β all from the Sanger Institute. Legends, honestly π«Ά
β SEE ALSO β
Samtools website: <http://www.htslib.org/> π
okay that's the whole page, you're officially a faidx expert, no cap π this was samtools-1.24, dated 9 July 2026, and it's giving "bioinformatics but make it cute" β¨ go index something, bestie ππ¦
π¦ where this page comes from
- epel 10: samtools 1.24-2.el10_3 Β· MIT
- nixpkgs unstable: samtools 1.24
- Copyright (C) 2008-2011, 2013-2018, 2020, 2024 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