Sambamba can replace most of the functionality of samtools. The main advantage of sambamba over samtools was parallelized BAM reading and writing.

Command & Options:

sambamba-view, sambamba-sort, sambamba-index, sambamba-merge, sambamba-slice, sambamba-flagstat, sambamba-markdup

sambamba-view

tool for extracting information from SAM/BAM files

  1. -S, --sam-input
  2. #Specify that the input is SAM file (default is BAM for all operations).
  3. -l, --compression-level=COMPRESSION_LEVEL
  4. # Set compression level for BAM output, a number from 0 to 9.
  5. -t, --nthreads=NTHREADS
  6. # Number of threads to use.
  7. -s, --subsample=FRACTION
  8. # subsample reads (read pairs)
  9. --subsampling-seed=SEED
  10. # set seed for subsampling to re-emerge the results.

sambamba-sort

sambamba sort does an external sort on input file.

  1. -m, --memory-limit=LIMIT
  2. # Sets an upper bound for used memory. Default memory limit is 512MiB. suffix K/KiB/KB/M/MiB/MB/G/GiB/GB recognized.
  3. -n, --sort-by-name
  4. # Default is 'coordinate'.

sambamba-index

sambamba index builds an index for a sorted by coordinate BAM file.

sambamba-markdup

sambamba-markdup - finding duplicate reads in BAM file

  1. -r, --remove-duplicates
  2. --hash-table-size=HASHTABLESIZE
  3. # size of hash table for finding read pairs (default is 262144 reads); will be rounded down to the nearest power of two; should be > (average coverage) * (insert size) for good performance
  4. --overflow-list-size=OVERFLOWLISTSIZE
  5. # size of the overflow list where reads, thrown away from the hash table, get a second chance to meet their pairs (default is 200000 reads); increasing the size reduces the number of temporary files created

samtools vs sambamba

samtools

  1. samtools sort -@ 4 -l 9 ~/SARS_CoV_2/bam/P3-VERO-P3-1-vero_L4.bam -o ~/SARS_CoV_2/vs/P3-VERO-P3-1-vero_L4_sort.bam

In this process, samtools sort created 208 Temporary files, taking 01:14:09.
sambamba - 图1

sambamba

  1. sambamba sort -t 4 -l 9 ~/SARS_CoV_2/mapping/P3-VERO-P3-1-vero_L4.bam -o ~/SARS_CoV_2/vs/P3-VERO-P3-1-vero_L4_sort1.bam

sambamba sort did not create Temporary files, but took 01:51:46.
When sorting a BAM file, Sambamba is not quicker than Samtools single-threaded.

More information:

https://lomereiter.github.io/sambamba/docs/sambamba-view.html