A fast Rust implementation for calculating pairwise SNP distance matrices from multiple sequence alignments. Inspired by https://github.com/gtonkinhill/pairsnp-cpp.
cargo install pairsnp-rsThe input file should be a multiple sequence alignment in FASTA format. Both regular and gzipped files are supported. IUPAC ambiguity codes are handled correctly.
The output is a pairwise SNP distance matrix. By default this is written to stdout in TSV format, but can be redirected to a file with -o or switched to CSV with -c. A sparse output mode (-s) is also available, optionally filtered by a distance threshold (-d).
pairsnp-rs -i input.fasta > output.txtUse multiple threads for large alignments:
pairsnp-rs -i input.fasta -t 8 -o output.tsvFor more information, run pairsnp-rs --help.
$ pairsnp-rs --help
Calculate pairwise SNP distances given a multiple sequence alignment.
Usage: pairsnp-rs [OPTIONS] --input <INPUT>
Options:
-i, --input <INPUT> Input FASTA file containing multiple sequence alignment
-o, --output <OUTPUT> Output file to write pairwise SNP distance matrix (optional, writes to stdout if not specified)
-t, --nthreads <NTHREADS> Number of threads to use (optional, default is 1)
-c, --csv Output in CSV format instead of TSV (optional, default output is TSV)
-s, --sparse Sparse output i.e. only non-zero distances and in s1,s2,dist format (optional, default output is dense)
-d, --threshold <THRESHOLD> Distance threshold for sparse output (optional, default is no threshold)
-x, --indices Output indices instead of sequence IDs (optional, default output is sequence IDs)
-h, --help Print help
-V, --version Print version