nx_align_match_stranded.nx
buildroot/runtime/nx_align_match_stranded.nx
about
nx_align_match_stranded.nx -- strand-aware seed matcher.
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/li-2018-minimap2-section-2.1
G1.3c of NISHI_GENOMICS_SUBSTRATE_ROADMAP.md. Real-world reads
arrive from either strand of the reference; a forward-only matcher
misses 50% of true alignments. This primitive matches BOTH the
forward-query minimizers and the reverse-complement-query
minimizers against the reference, tagging each emitted pair with
strand orientation.
Strand semantics:
q_fwd_* -- minimizers from the query as given
q_rc_* -- minimizers from the reverse-complement of the query
(the caller pre-extracts these via dna_revcomp +
minimizer_extract)
Match emits forward-strand pairs first (tag = NX_STRAND_FWD = +1),
then reverse-strand pairs (tag = NX_STRAND_REV = -1).
Within each strand, emission follows minimizer_match's outer-q /
inner-r order so chain DP sees a deterministic stream.
Why canonical-k-mer minimizers are NOT enough on their own:
Canonical k-mers are strand-invariant by construction (the
smaller of forward and revcomp wins), so the SET of canonical
minimizer VALUES is identical between a query and its revcomp.
But the POSITIONS differ: a query base at position i corresponds
to revcomp-query base at position (n - 1 - i). Strand info
lives in this position-mapping, not in the value. Therefore
we run TWO matches and tag the output stream.
q_pos semantics in the output:
Forward pairs: q_pos refers to the original query's coordinate
(where the k-mer starts in the query as given).
Reverse pairs: q_pos refers to the REVCOMP-QUERY coordinate.
Downstream chain DP and SW-extension are responsible for
un-mapping reverse-strand q_pos back to original-query
coordinates when needed (see G1.4b nx_alignment_record).
API:
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_const.nxnx_align_match.nx
imported by: nx_align_match_stranded_test.nx
structs
| none |
consts
| none |
functions
| 89 | func minimizer_match_stranded( |