Skip to content

Refine chimera-diagnostics (higher-order/trimera screening) and validate against truth set #55

Description

@cjfields

Tracking follow-up for the chimera-diagnostics subcommand added in #54. The bimera-based remove-bimera-denovo does not catch higher-order chimeras (trimeras); some lower-abundance reads on long amplicons (nodA) and low-biomass samples survive bimera removal yet look chimeric. #54 surfaces the bimera coverage signal as a diagnostic TSV and a refined trimera_suspect call. This issue tracks refinement and validation. remove-bimera-denovo work stays open.

What's in #54

A read-only chimera-diagnostics TSV (does not filter). trimera_suspect is gated on metrics the alignment pass already computes:

  • nearest_parent_dist (min ends-free Hamming to any single parent) — the key variant-vs-mosaic disambiguator.
  • third parent must beat the end parents in the gap (gap_mismatches < gap_end_parent_mismatches).
  • both flanks >= min_flank (two real junctions) — rejects tiny-flank divergent singletons.
  • min_gap_len — rejects the one-off-bimera tier (gap ≈ 1).

CLI knobs: --trimera-{min-parent-dist=15,min-gap=20,max-gap-error=0.10,min-flank=30}.

On a 5-sample nodA subset, suspects dropped 12+ → 1 (an abundant A-flanked / C-middle recombinant between the two dominant ASVs).

Follow-up work

  • Ground-truth validation. The original suspects were found by comparing reads to the known Rhizobium reference sequences (known mixtures). Use those references + the student's flagged sequence IDs as a truth set; check the diagnostic's calls (incl. ASV 37dff925) against them.
  • Tune defaults against real positives/negatives rather than synthetic intuition (thresholds currently tuned on ~600 bp nodA).
  • Run on deeper samples (e.g. the ~332k-read N_258) where rarer mosaics are likelier; the PR run used a 5-sample subset.
  • Decide downstream integration. Diagnostic-only for now; consider an optional filter/annotate mode and whether (nflag, nsam) from the consensus path should be exportable to allow re-thresholding without re-aligning.
  • Length-variable background. nodA has off-target/concatemer fragments; confirm the aligned nearest_parent_dist handles cross-length comparisons sensibly.
  • WFA backend. Re-run with --align-backend wfa2 and confirm gap coordinates are stable (junction gap placement could shift).

Notes

  • nodA dataset: data/nodA/demux_fastq (74 samples); primers fwd TGCRGTGGAARNTRNNCTGGGAAA, rev GGNCCGTCRTCRAAWGTCARGTA; dominant amplicon ~696 bp with a varied background tail.
  • A real trimera test on the cluster side is planned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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