SAM/BAM and related specifications
Alignment data files
SAMv1.tex is the canonical specification for the SAM (Sequence Alignment/Map) format, BAM (its binary equivalent), and the BAI format for indexing BAM files. SAMtags.tex is a companion specification describing the predefined standard optional fields and tags found in SAM, BAM, and CRAM files. These formats are discussed on the samtools-devel mailing list.
CRAMv3.tex is the canonical specification for the CRAM format, while CRAMv2.1.tex describes its now-obsolete predecessor. Further details can be found at ENA’s CRAM toolkit page. CRAM discussions can also be found on the samtools-devel mailing list.
The tabix.tex and CSIv1.tex quick references summarize more recent index formats: the tabix tool indexes generic textual genome position-sorted files, while CSI is htslib’s successor to the BAI index format.
Unaligned sequence data files
We do not define or endorse any dedicated unaligned sequence data format. Instead we recommend storing such data in one of the alignment formats (SAM, BAM, or CRAM) with the unmapped flag set. However for completeness, we list the commonest formats below with external links.
FASTA is an early sequence-only format originally defined by William Pearson’s tool of the same name.
FASTQ was designed as a replacement for FASTA, combining the sequence and quality information in the same file. It has no formal definition and several incompatible variants, but is described in a paper by Cock et al.
Variant calling data files
VCFv4.3.tex is the canonical specification for the Variant Call Format and its textual (VCF) and binary (BCF) encodings, while VCFv4.1.tex and VCFv4.2.tex describe their predecessors. These formats are discussed on the vcftools-spec mailing list.
BCFv2_qref.tex is a quick reference describing just the layout of data within BCF2 files.
Htsget.md describes the hts-get retrieval protocol, which enables parallel streaming access to data sharded across multiple URLs or files.
Refget.md enables access to reference sequences using an identifier derived from the sequence itself.