Justin Boone
Standard sequence alignment models biological homology through the metric space of edit distance. While effective for global orthology, this rigid geometric assumption struggles with discrete biological realities-such as insertions/deletions (indels) and fragment-to-reference asymmetry-forcing a reliance on heuristic gap penalties. To address this, we propose Task-Geometry Alignment (TGA), a design principle that structurally aligns algorithmic representation with the intrinsic geometry of the biological task. We implement TGA in TGALIGN, an expert-parameter-independent tool that tiles reference databases to match query lengths, encodes sequences into gap-robust syncmer profiles, and indexes them for high-speed Approximate Nearest Neighbor (ANN) search. Benchmarking against leading aligners (USEARCH, VSEARCH, MMseqs2) demonstrates performance strictly bounded by biological architecture. On standard substitution-heavy markers (COI), TGAlign achieves statistical parity with the state-of-the-art. Conversely, on sequence fragments and indel-heavy markers, TGAlign yields statistically significant accuracy improvements (up to 10% on 16S) while matching the peak performance of MMseqs2 on highly variable ITS datasets. By translating sequence comparison into dense matrix operations via ANN indexing, the current implementation maintains sub-millisecond query latency-an order-of-magnitude reduction over traditional aligners-providing a robust and scalable framework for post-alignment genomic search. Source code is available at https://github.com/JustinBooneLab/TGAlign and datasets are archived at Zenodo (DOI: 10.5281/zenodo.17973054).