Sam/Bam Manipulation


samtools sort -O bam -o sorted_input.bam [INPUT SAM]


-l INT
Set the desired compression level for the final output file, ranging from 0 (uncompressed) or 1 (fastest but minimal compression) to 9 (best compression but slowest to write), similarly to gzip(1)'s compression level setting. If -l is not used, the default compression level will apply.
-m INT
Approximately the maximum required memory per thread, specified either in bytes or with a K, M, or G suffix. [768 MiB]
Sort by read names (i.e., the QNAME field) rather than by chromosomal coordinates.
Write the final sorted output to FILE, rather than to standard output.
Write the final output as sam, bam, or cram. By default, samtools tries to select a format based on the -o filename extension; if output is to standard output or no format can be deduced, bam is selected.
Write temporary files to PREFIX.nnnn.bam, or if the specified PREFIX is an existing directory, to PREFIX/samtools.mmm.mmm.tmp.nnnn.bam, where mmm is unique to this invocation of the sort command. By default, any temporary files are written alongside the output file, as out.bam.tmp.nnnn.bam, or if output is to standard output, in the current directory as samtools.mmm.mmm.tmp.nnnn.bam.
-@ INT
Set number of sorting and compression threads. By default, operation is single-threaded.

Protocols using this tool

Transcript-level expression analysis of RNA-seq experiments with HISAT, StringTie

Share your experience or ask a question