mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.5 KiB
1.5 KiB
obialign Package: Semantic Overview (≤50 lines)
The obialign package provides a lightweight, high-performance utility for detecting single-edit-distance relationships between biological sequences (obiseq.BioSequence). Its core function, D1Or0, determines whether two sequences are either identical or differ by exactly one substitution, insertion, or deletion (indel).
abs[k]: A generic helper computing absolute values for integers or floats (via Go generics).D1Or0(...): Returns a 4-tuple:int(first):0if identical,1if differing by one edit,-1otherwise.int(second): Position of the differing site (-1if identical).byte,byte: Mismatched characters (or'-'for gaps indicating indels).
Algorithmic strategy:
- Early rejection if length difference exceeds 1.
- Forward scan until first mismatch → identifies left boundary of divergence.
- Backward scan from ends to find rightmost match boundary.
- Validates whether the mismatch region allows exactly one edit:
- Single substitution: equal lengths, single divergent position.
- Insertion/deletion: length differs by 1 and only one non-overlapping character remains.
Designed for speed in OTU/ASV dereplication or error correction pipelines (e.g., metabarcoding), where rapid filtering of near-identical sequences is critical. Does not compute full alignments; optimized for binary decision-making under strict edit constraints.