Skip to content

consensus: fix six gene-structure bugs reported in #4 - #5

Open
xiekunwhy wants to merge 1 commit into
BFL-lab:masterfrom
xiekunwhy:pr/consensus-bugfixes
Open

xiekunwhy wants to merge 1 commit into
BFL-lab:masterfrom
xiekunwhy:pr/consensus-bugfixes

Conversation

@xiekunwhy

Copy link
Copy Markdown

This PR fixes the six consensus bugs reported in issue #4, plus a sixth one we
found while validating the fixes (fully-masked introns splitting real genes).
Each fix carries a targeted unit test; the full suite passes and the golden
consensus output on the EVM testing data set is unchanged.

  1. partial3 semantics — a mid-gene premature stop (the ORF projection
    truncates the CDS and demotes downstream path exons to three_prime_UTR)
    was reported as a complete 3' end. partial3=false now requires the
    projected CDS to reach the terminal exon (empty three_prime_UTR).
    In our plant-genome run, 4,456 of 36,439 screened "complete" genes were
    silently truncated this way.
  2. GFF3 phase column honored — prediction CDS rows' column-8 phase was
    discarded and every chain assumed to start in frame 1, frame-shifting all
    5'-partial input predictions (Helixer/Tiberius/AUGUSTUS emit these
    routinely). Each chain now carries the phase of its 5'-most CDS row
    (translation order) and uses it to seed inherited frames.
  3. Stop-screening escape hatch — try_add_exon inserted exons even when
    determine_good_phases found an in-frame stop in all three frames
    (the guard only fired on non-empty results).
  4. Conditional 3 bp trim — terminal/single exons now trim their trailing
    3 bp only when those 3 bp actually encode a stop under the configured
    genetic code; pipelines whose CDS rows exclude the stop codon (separate
    stop_codon features) no longer lose 3 genuine coding bases.
  5. No unchecked-complete fallback — the genome-fetch-failure fallback in
    resolve() emitted the raw path exons as CDS with no stop scan and could
    mark it complete; hit_stop is now false there.
  6. Fully-masked introns registered with score 0 (EVM parity) — EVM
    registers an intron even when repeat-masking zeroes its score
    ($INTRONS_TO_SCORE{$key} += 0), keeping trellis connectivity; combinr
    skipped registration entirely. In a genome that is 80% repeat-masked this
    split real genes whose introns are covered by TE insertions (one concrete
    BUSCO-complete-in-EVM locus dissected in Some issues #4 follow-up). Masked bases still
    contribute no score, so the anti-TE purpose of --repeats is preserved.

Validation: cargo test all green (including the new tests for each fix);
A/B against the upstream binary on the EVM testing/ set is byte-identical.

A follow-up PR (see follow-up PR for the flags) builds three opt-in production flags on top of this one.

1. partial3: a mid-gene premature stop (projection truncates the CDS and
   demotes path exons to three_prime_UTR) is no longer reported as a
   complete 3 end; partial3=false now requires the projected CDS to reach
   the terminal exon (empty three_prime_UTR).
2. honor the GFF3 phase column of prediction CDS rows: each chain carries
   the phase of its 5-prime-most CDS row and uses it to seed inherited
   frames, so 5-prime-partial inputs are no longer frame-shifted.
3. try_add_exon no longer inserts exons that carry an in-frame stop in
   every reading frame (empty determine_good_phases result was let
   through the guard).
4. terminal/single exons trim their trailing 3 bp only when those 3 bp
   actually encode a stop under the configured genetic code (CDS rows of
   many pipelines exclude the stop codon).
5. the genome-fetch-failure fallback in resolve() no longer emits
   unchecked CDS marked complete (hit_stop=false there now).
6. fully repeat-masked introns are registered with score 0 (EVM parity):
   masking zeroes an intron score but must not sever trellis
   connectivity (TE-intron genes in repeat-rich genomes stay whole).

Each fix carries a targeted unit test. Full suite passes (194 lib tests);
golden consensus output unchanged on the EVM testing data set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant