Fast SAM/BAM sorter.
mako is a focused, single-purpose command-line tool for sorting SAM and
BAM files. It sorts by coordinate, queryname (lexicographic or natural),
or template-coordinate, and can verify whether a file is already
correctly sorted without rewriting it.
- External merge-sort — handles BAM files larger than available RAM via spill-to-disk.
- Parallel radix sort for in-memory chunks.
- Multiple sort orders:
coordinate— standard genomic order (tid → pos → strand); use for IGV, variant calling, etc.queryname— lexicographic read name (default sub-sort, fast).queryname::natural—samtools-compatible natural numeric order.template-coordinate— paired-end reads grouped by template position.
--verifymode — check a file's sortedness in one streaming pass without writing output.- Drop-in for
samtools sortfor the common cases.
From crates.io — note the
package name is fg-mako (the unprefixed mako is taken on
crates.io by an unrelated, abandoned crate), but the installed binary
is mako:
cargo install fg-makoOr grab a pre-built binary from the GitHub releases page for Linux and macOS on x86_64 and aarch64.
Sort by coordinate:
mako -i in.bam -o out.bam --order coordinate --threads 8Sort by query name (samtools-compatible natural order):
mako -i in.bam -o out.bam --order queryname::naturalVerify sort order without rewriting:
mako -i sorted.bam --verify --order coordinateRun mako --help for the full list of options including memory limits,
temp-directory placement, compression level, and verification mode.
--order |
Order | Typical use |
|---|---|---|
coordinate |
tid → pos → strand |
IGV, variant calling, indexing |
queryname |
Lexicographic read name (default sub-sort) | Fast queryname sort |
queryname::natural |
Natural numeric read name | samtools-compatible |
template-coordinate |
Paired reads grouped by template | UMI grouping pipelines |
mako inherits its sort engine from fgumi.
On a 30M-read WGS BAM, the engine sorts roughly 1.9× faster than
samtools sort for template-coordinate order. See the fgumi
documentation for detailed benchmarks and tuning guidance.
mako is a focused packaging of the SAM/BAM sort engine from
fgumi. All sort logic lives
upstream; mako tracks fgumi releases and exists to provide a small,
stable, easily installed sort binary for users who don't need fgumi's
broader UMI tooling.
See CONTRIBUTING.md. Issues that look like sort engine bugs (correctness, performance) belong on the fgumi issue tracker; mako-specific issues (CLI ergonomics, packaging, distribution) belong here.
MIT — see LICENSE and THIRDPARTY.toml.