Scroll to navigation

SAMBAMBA-SORT(1) SAMBAMBA-SORT(1)

NAME

sambamba-sort - tool for sorting BAM files

SYNOPSIS

sambamba sort OPTIONS <input.bam>

DESCRIPTION

BAM files can have either ´coordinate´ sort order, or ´qname´ one.

The first one means to sort the file by (integer) reference ID, and for each reference sort corresponding reads by start coordinate.

´qname´ sorting order is when reads are sorted lexicographically by their names.

sambamba sort does an external stable-type sort on input file. That means it reads the source BAM file in chunks that fit into memory, sorts them and writes to a temporary directory, and then merges them. After merging temporary files are removed automatically.

Both sorting orders are supported. Default one is ´coordinate´ because this is the one used for building index later. In order to switch to ´qname´ sorting order, use -n|--sort-by-name flag.

OPTIONS

Sets an upper bound for used memory. However, this is very approximate. Default memory limit is 512MiB. Increasing it will allow to make chunk sizes larger and also reduce amount of I/O seeks thus improving the overall performance.
LIMIT must be a number with an optional suffix specyfying unit of measumerent. The following endings are recognized: K, KiB, KB, M, MiB, MB, G, GiB, GB.
Use TMPDIR to output sorted chunks. Default behaviour is to use system temporary directory.
Output file name. If not provided, the result is written to a file with .sorted.bam extension.
Sort by read name instead of doing coordinate sort.
Compression level to use for sorted BAM, from 0 (known as uncompressed BAM in samtools) to 9.
Write sorted chunks as uncompressed BAM. Default behaviour is to write them with compression level 1, because that reduces time spent on I/O, but in some cases using this option can give you a better speed. Note, however, that the disk space needed for sorting will typically be 3-4 times more than without enabling this option.
Show wget-like progressbar in STDERR (in fact, two of them one after another, first one for sorting, and then another one for merging).
Number of threads to use.

SEE ALSO

For more information on the original samtools SORT behaviour, check out the samtools documentation http://samtools.sourceforge.net/samtools.shtml.

BUGS

At the moment, the memory is used quite ineffectively for really large files.

February 2015