Skip to content
naulon

No retraction, correction or concern found when last checked on Oct 15, 2026.

Sambamba: fast processing of NGS alignment formats

Artem Tarasov, Albert J. Vilella, Edwin Cuppen and 2 more

Bioinformatics · 2015 · CC BY

doi:10.1093/bioinformatics/btv098

Abstract

Summary: Sambamba is a high-performance robust tool and library for working with SAM, BAM and CRAM sequence alignment files; the most common file formats for aligned next generation sequencing data. Sambamba is a faster alternative to samtools that exploits multi-core processing and dramatically reduces processing time. Sambamba is being adopted at sequencing centers, not only because of its speed, but also because of additional functionality, including coverage analysis and powerful filtering capability. Availability and implementation: Sambamba is free and open source software, available under a GPLv2 license. Sambamba can be downloaded and installed from http://www.open-bio.org/wiki/Sambamba. Sambamba v0.5.0 was released with doi:10.5281/zenodo.13200. Contact: j.c.p.prins@umcutrecht.nl

Full text

From PubMed Central, U.S. National Library of Medicine, as current on Oct 16, 2026. Paragraph numbers are ours, so an answer can point at one.

1. Introduction

Processing speed matters, not only for diagnostics, but also for analysis and sharing of computational resources. Next-generation sequencing (NGS) is increasingly used as a genetic screening tool in diagnostics and reducing time from sample intake to test result/diagnosis potentially saves lives. Introducing multi-core processing can accelerate steps in a pipeline when the CPU is the bottleneck.

Since its introduction by the 1000 Genomes Project, the sequence alignment/map format (SAM) and its compressed binary counterpart (BAM) have become the de facto file formats used for storing and distributing NGS data. Samtools is the original tool for SAM/BAM files processing, including data extraction and filtering. Recently, samtools added the CRAM format as a compressed alternative to SAM/BAM. While samtools exploits the speed of the low-level C programming language and uses streamed data for efficiency, it has limited support for parallel processing (Fig. 1). Samtools has inspired a number of other BAM processors, notably Picard, samblaster, biobambam and Scramble, each of which is either slower than samtools, or offers a subset of its functionality.

To accelerate analysis pipelines we created Sambamba, a new incarnation of samtools that fully utilizes parallel processing. Sambamba (which means ‘parallel’ in Swahili) is written in the D programming language, a modern programming language with run-time performance similar to that of C. D has powerful abstractions for parallel computing which make it possible to scale computations with the number of cores (Fig. 1). When running a Human cancer exome SNV calling pipeline on the results of a single Illumina HiSeq 2500 flowcell in fast mode (2000 genes, 300 million reads, 100 bp read length and average read depth of 100 for six samples) following standard best practice guidelines, the bioinformatics processing time was reduced from 2 h to 30 min by replacing Picard markdup and samtools index, flagstat, merge and view.

2. Features

Sambamba introduces full parallelized data processing of SAM, BAM and CRAM files. Sambamba primarily uses D’s parallel processing capabilities. For CRAM support the htslib C-library was linked against. And for mpileup support the original samtools program is called in map-reduce fashion. This resulted in improved processing speed on multi-core computers (Table 1). Sambamba is most effective on machines where CPU utilization is the constraining factor (Fig. 1). The gain may therefore be limited on cluster setups where shared storage is a bottleneck (e.g. ).

Compatibility: Sambamba is a robust replacement for the commonly used samtools commands: index, sort, view, mpileup, markdup, merge and flagstat. The output of sambamba compares to that of samtools, except for markdup, where the Picard ‘sum of base qualities’ method was chosen. Sambamba’s RAM utilization compares to that of samtools; only with sort sambamba uses significantly less RAM.

New functionality: Sambamba adds new functionality compared with existing tools. To be able to calculate coverage statistics, read depth analysis was added. To speed up splitting BAM files, slice was added which copies large regions without decompression. And when a BED file is supplied to view, the index is used to decompress only those regions that are actually visited.

To further shorten processing time, index files are created on the fly by sort, view, markdup and merge. And to combine multiple steps into one, powerful filtering with logic operators and regular expressions was added. For example, to filter on mapping quality and CIGAR

mapping_quality >= 30 and cigar = ∼ / ∧ \d+M1I\d+M$/

Finally, to make it easier to process results, sambamba view can generate output in the standard JSON format.

Source code: Sambamba abides by the rules of the ‘Small tools MANIFESTO for Bioinformatics’. The sambamba source code is extensible and maintainable. For SAM parsing we opted for Ragel, a finite-state machine compiler, which generates a fast look-ahead parser with input validation, making the code base even more compact. Sambamba uses a unit testing framework with continuous integration testing, so that existing functionality is validated every time the code base is changed.

3. Conclusion

Sambamba is a software engineering example that shows how to make effective use of the D programming language and multi-core computers to reduce the time needed to get from sample to result. Whole genome sequencing and growing sample numbers make such performance improvements increasingly relevant.

References 12

  1. 1.

    Alexandrescu A. (2010 ) The D Programming Language. Addison-Wesley, Upper Saddle River, NJ.

    Not in our library

  2. 2.

    Bonfield J.K. (2014 ) The Scramble conversion tool. Bioinformatics, 30, 2818–2819.

    Not in our library10.1093/bioinformatics/btu390

  3. 3.

    Cochrane G. (2013 ) Facing growth in the European Nucleotide Archive. Nucleic Acids Res., 41(Database issue), D30–D35.

    Not in our library10.1093/nar/gks1175

  4. 4.
  5. 5.

    Gullapalli R.R. (2012 ) Next generation sequencing in clinical medicine: challenges and lessons for pathology and biomedical informatics. J. Pathol. Inf., 3, 40.

    Not in our library10.4103/2153-3539.103013

  6. 6.

    Li H. (2009 ) The sequence alignment/Map format and SAMtools. Bioinformatics, 25, 2078–2079.

    Not in our library10.1093/bioinformatics/btp352

  7. 7.

    Picard (2009 ) Picard. http://picard.sourceforge.net/.

    Not in our library

  8. 8.

    Prins P. (2014 ) Small tools MANIFESTO for bioinformatics. 10.5281/zenodo.11321.

    Not in our library

  9. 9.

    Siva N. (2008 ) 1000 Genomes project. Nat. Biotechnol., 26, 256.

    Not in our library10.1038/nbt0308-256b

  10. 10.

    Thurston A.D. (2006 ) Parsing computer languages with an automaton compiled from a single regular expression. In: Ibarra O.H. Yen H.-C. (eds.), CIAA. Lecture Notes in Computer Science, vol. 4094, Springer, New York, pp. 285–286.

    Not in our library

  11. 11.

    Tischler G. Leonard S. (2014 ) biobambam: tools for read pair collation based algorithms on BAM files. Source Code Biol. Med., 9, 13.

    Not in our library

  12. 12.

    Trelles O. (2011 ) Big data, but are we ready? Nat. Rev. Genet., 12, 224.

    Not in our library10.1038/nrg2857-c1

Cited by papers we hold 51

and 31 more

Reads

Read by people on this page

None yet.

Checked or read by AI through naulon

None yet.

A person counts once a day per paper. We keep no cookie and no address: a reader is a hash that changes every day. Any month under five reads shows no number.

Are you an author?

Is this your paper?

Claim it to add your note and be paid when agents cite it. Free.