Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2021 Feb 16;10(2):giab007.
doi: 10.1093/gigascience/giab007.

HTSlib: C library for reading/writing high-throughput sequencing data

Affiliations

HTSlib: C library for reading/writing high-throughput sequencing data

James K Bonfield et al. Gigascience. .

Abstract

Background: Since the original publication of the VCF and SAM formats, an explosion of software tools have been created to process these data files. To facilitate this a library was produced out of the original SAMtools implementation, with a focus on performance and robustness. The file formats themselves have become international standards under the jurisdiction of the Global Alliance for Genomics and Health.

Findings: We present a software library for providing programmatic access to sequencing alignment and variant formats. It was born out of the widely used SAMtools and BCFtools applications. Considerable improvements have been made to the original code plus many new features including newer access protocols, the addition of the CRAM file format, better indexing and iterators, and better use of threading.

Conclusion: Since the original Samtools release, performance has been considerably improved, with a BAM read-write loop running 5 times faster and BAM to SAM conversion 13 times faster (both using 16 threads, compared to Samtools 0.1.19). Widespread adoption has seen HTSlib downloaded >1 million times from GitHub and conda. The C library has been used directly by an estimated 900 GitHub projects and has been incorporated into Perl, Python, Rust, and R, significantly expanding the number of uses via other languages. HTSlib is open source and is freely available from htslib.org under MIT/BSD license.

Keywords: bcftools; data analysis; high-throughput sequencing; next generation sequencing; samtools; variant calling.

PubMed Disclaimer

Conflict of interest statement

The authors declare they have no competing interests.

Figures

Figure 1:
Figure 1:
Htslib design.
Figure 2:
Figure 2:
BAM elapsed read/write times, with up to 16 threads available.
Figure 3:
Figure 3:
Time and megabytes of data read, for exon list in BAM.
Figure 4:
Figure 4:
VCF.gz and BCF read and read/write times, 929 samples.

References

    1. The 1000 Genomes Project Consortium. A global reference for human genetic variation. Nature. 2015;526:68–74. - PMC - PubMed
    1. Li H, Handsaker B, Wysoker A, et al. The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009;25:2078–9. - PMC - PubMed
    1. Danecek P, Auton A, Abecasis G, et al. The variant call format and VCFtools. Bioinformatics. 2011;27:2156–8. - PMC - PubMed
    1. Li H. A statistical framework for SNP calling, mutation discovery, association mapping and population genetical parameter estimation from sequencing data. Bioinformatics. 2011;27:2987–93. - PMC - PubMed
    1. SAMtools, Version 1.11 2020. https://github.com/samtools/samtools/releases/tag/1.11. Accessed 9 February 2021.

Publication types