Skip to content

Alignment executor (Case 2: reads + ref) #77

@crashfrog

Description

@crashfrog

Parent

#58 (Phase 1 MVP: Evidence-Informed Alignment with Deferred Filtering)

What to build

Implement AlignmentExecutor in phraya-align that orchestrates the full alignment pipeline: seed → extend (WFA) → score (multi-mapping) → record (VariantObservations + coverage_track + query_index). Handles alignment failures gracefully (log error, continue with remaining tasks).

For each query, find seeds against target, extend each seed with WFA, score all alignments, keep primary + alternatives ≥ 0.95 score ratio, extract variants from primary alignment, update coverage track, write to .phraya and .phraya.queries.

Acceptance criteria

  • align_task(query: &Sequence, target: &Sequence, plan: &PhrayaPlan) → AlignmentResult
  • Pipeline: find_seeds → wfa_extend for each seed → score_alignments → extract variants
  • Extract VariantObservations: positions where query != target in primary alignment
  • Compute local_coverage (±50bp window) from all overlapping alignments at each position
  • Update coverage_track (quantize, RLE-compress)
  • Write query_index (all positions + scores for this query)
  • Handle failures: if WFA fails, log error, return None, don't crash
  • Tests: single read, perfect match → no variants, full coverage
  • Tests: single read with SNP → one VariantObservation at SNP position
  • Tests: multi-mapping read → primary + alternatives in query_index
  • Integration test: align 10 reads → verify output file counts

Blocked by

#74 (seed finding), #70 (WFA), #75 (multi-mapping scorer), #76 (.phraya format), #77 (.queries format)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions