Skip to content

consensus: production-hardening flags (off by default) — follow-up to #4 - #6

Open
xiekunwhy wants to merge 2 commits into
BFL-lab:masterfrom
xiekunwhy:pr/consensus-flags
Open

xiekunwhy wants to merge 2 commits into
BFL-lab:masterfrom
xiekunwhy:pr/consensus-flags

Conversation

@xiekunwhy

Copy link
Copy Markdown

Depends on / includes #5 (first commit here is that PR; easiest reviewed commit-by-commit).

While validating combinr on a 2.5 Gb, 80%-repeat plant genome we needed three
opt-in behaviours to reach EVM-level output. All are off by default —
with them off, output is unchanged (golden tests untouched).

  1. --require-atg-start — prediction exons typed initial/single whose
    start codon is not ATG are demoted so they cannot begin a gene (EVM's
    canonical START gate, limited to the start codon only). At resolution, a
    CDS not starting with ATG is trimmed in-frame to the first ATG (≤ 120
    codons); when the path holds no in-frame ATG at all (truncated evidence
    start), the 5'-most exon is extended upstream (cap 5 kb) to the first ATG
    bounded by the nearest upstream in-frame stop, with the 5'UTR trimmed to
    just past that stop. Rationale: homology/transferred predictions (weight
    10 in our weights) frequently carry 5' truncations and otherwise outrank
    ATG-starting ab-initio starts (weight 2). Before: 2,218/22,484 screened
    proteins lacked an ATG start and were all discarded by gffread -J
    (BUSCO C dropped 91.5% → 85.6%). After: zero such proteins, and ~1,400
    evidence-rich genes with clipped starts were recovered as complete.
  2. Consensus-side 3' extension (sharing --extend-terminal-stop) — an
    ORF that runs off the end of its path extends the 3'-most exon downstream
    to the first in-frame stop (cap MAX_TERMINAL_EXTEND), EVM's
    extend_to_terminal half that combinr had not ported. 43/50 of our
    screened-out BUSCO loci were exactly this case.
  3. --intron-score-cap <bp|auto> — caps the unmasked length contributing
    to one intron's score (weight × min(len, cap)); auto selects smooth
    logarithmic scaling (weight × len up to 1 kb, then
    weight × 1 kb × (1 + ln(len/1 kb))), which needs no species-specific
    tuning. Uncapped, a 15-38 kb intron from a misassembled transcript
    outweighs any intergenic signal and the trellis absorbs the neighbouring
    real gene (observed repeatedly; e.g. a 15.4 kb intron bridging into the
    BUSCO gene at Chr01:188,523,992 from an upstream transcript artefact).
    A 1000/2000/3000/5000/auto sweep gave 92.9/93.9/93.7/93.7/93.9 (BUSCO C);
    auto matched the best hard cap without tuning. Vertebrates with
    genuinely long introns (10-100 kb) should prefer auto over a low hard
    cap, since a hard cap can let strong intergenic signals split real
    long-intron genes.

Net result — same inputs, same screening, gffread -J validated protein
sets, BUSCO embryophyta_odb10 (n=1614):

gene set C F M
combinr v0.2.0 (unpatched), post--J 85.6% 1.5% 12.9%
EVidenceModeler 93.9% 1.5% 4.6%
combinr + fixes + flags 94.7% 1.1% 4.2%

All retained proteins are structurally clean (ATG start, terminal stop, no
in-frame stops). Full cargo test passes, including new tests for each
behaviour.

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.
Adds three opt-in behaviours developed while validating on a 2.5 Gb,
80%-repeat plant genome (all off by default; default output unchanged,
goldens untouched):

- --require-atg-start: prediction exons typed initial/single whose start
  codon is not ATG are demoted so they cannot begin a gene (EVM canonical
  START gate, limited to the start codon). At resolution a CDS not
  starting with ATG is trimmed in-frame to the first ATG (<=120 codons);
  when the path holds no in-frame ATG at all (truncated evidence start),
  the 5-prime-most exon is extended upstream (cap 5 kb) to the first ATG
  bounded by the nearest upstream in-frame stop, with the 5 UTR trimmed
  to just past that stop.
- consensus-side 3 extension under --extend-terminal-stop: an ORF that
  runs off the end of its path extends the 3-prime-most exon downstream
  to the first in-frame stop (EVM extend_to_terminal).
- --intron-score-cap <bp|auto>: caps the unmasked length contributing to
  one introns score (weight x min(len, cap)); auto selects smooth
  logarithmic scaling (linear up to 1 kb, then weight x 1 kb x
  (1 + ln(len/1 kb))) for species-agnostic anti-fusion control.

On the same inputs and screening, screened + gffread -J validated
proteins score BUSCO C 85.6% -> 94.7% (embryophyta_odb10), vs EVM 93.9%,
with all retained proteins structurally clean.
@xiekunwhy xiekunwhy mentioned this pull request Oct 9, 2026
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