A fast, lightweight implementation of Smith-Waterman
All notable changes to this project are documented here. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
align(ref, query, { mode, matrix, gap, band, table, scoreOnly }).
The positional signature from 0.1.x still works.semiglobal mode: the whole query is aligned to the best region of the
reference, with free end gaps on the reference.refStart, refEnd, queryStart and queryEnd (0-based,
end-exclusive). position is kept as an alias of refStart.scoreOnly option: skips the traceback and uses O(query) memory.aa24 encoding table and the BLOSUM62 matrix.alignmentStats (matches, mismatches, gaps, identity and an
=/X extended CIGAR), str2cigar, reverseComplement, encode,
alphabetSize and genScoreMatrix.RangeErrors when the encoding table and score matrix do not match, or
when the traceback would need too much memory.src/, built with tsup) using typed arrays: roughly
2.5-3x faster and far less memory (a 10 kb x 10 kb alignment used about 1.6 GB
of heap before).null when no positive-scoring alignment
exists; this is now documented.gen_score_matrix, gen_query_profile, bsg_enc_seq and makeIntArray
are deprecated (still exported).null handling.w was silently ignored in 0.1.x (a typo,
t.reference instead of t.length, made it NaN). Banding now works: a 10 kb
global alignment with a band of 50 takes about 23 ms instead of about 440 ms.cigar2str returned a comma-separated string ("5M,2I,4M"); it now returns
the standard "5M2I4M".ksw.c): the edge diagonal
of the band was excluded, and a leading gap could pass through cells outside
the band. Banded global scores now exactly match a reference implementation
restricted to the same band.cigar2str output format changed from "5M,2I,4M" to "5M2I4M".w can differ
from 0.1.x.exports map and an ESM build, and main moved to
dist/index.cjs. Deep imports of other files in the package are no longer
possible.Single-file JavaScript implementation ported from Heng Li’s ksw.c.