← Back to devlog

2026-07-04 — v22 contig assembly

Work unit 3: load two Sanger reads (typically a forward + reverse pair) and the viewer assembles them into a consensus contig entirely in the browser — no server, no upload, no new npm dependencies. The overlap is found by an ungapped greedy algorithm that tries all four strand orientations, builds a per-position layout, calls IUPAC ambiguity codes at mismatched positions, and exports a clean FASTA. The privacy wedge — data never leaving the machine — is preserved end-to-end.

What changed

Spec grounding

Tests

New test coverage for v22
FileCountWhat is asserted
tests/core/contig.test.ts 33 reverseComplement exact output including IUPAC bases; scoreOverlap exact numeric values for match / mismatch / N / IUPAC near-match / gap; findBestOverlap null on no-overlap, null on all-mismatch, fwd orientation, fwd-rc orientation, rev (B upstream) orientation, best-score selection across lengths; buildPairedContig exact contig length, consensus string, overlapStart/End, coverage array, mismatchCount=0 for identical overlap, singleCoverageCount, IUPAC ambiguity code at mismatch position, quality-weighted winner, fwdName/revName assignment, readIds pairing, support array length and sequential consensusIndex values; toContigFasta exact header + sequence bytes and 80-char line wrap.
tests/e2e/contig.e2e.test.ts 6 Panel visible after load; Assemble disabled with one trace; Assemble enabled with two traces; clicking Assemble shows summary with numeric contig info; FASTA download header starts with >contig [; Assemble re-disabled after closing second trace.

Design decisions