Skip to content

KEGG FASTA/HMM reconstruction: align model output with MATLAB RAVEN - #77

Merged
edkerk merged 1 commit into
developfrom
fix/kegg-fasta-parity
Jul 18, 2026
Merged

KEGG FASTA/HMM reconstruction: align model output with MATLAB RAVEN#77
edkerk merged 1 commit into
developfrom
fix/kegg-fasta-parity

Conversation

@edkerk

@edkerk edkerk commented Jul 18, 2026

Copy link
Copy Markdown
Member

Brings the protein-FASTA reconstruction path (get_kegg_model_from_sequences)
into byte-parity with RAVEN develop3 getKEGGModelForOrganism (HMM branch), so
the Python and MATLAB pipelines produce identical draft models from the same FASTA
and the shared raven-data artefacts.

Changes

  • Prune kegg.orthology to matched KOs. assemble_model_from_ko_genes gains a
    prune_orthology flag (default off, so the organism-annotation path keeps the full
    reference KO list); the FASTA path passes True. Each gene-backed reaction's
    kegg.orthology is restricted to the KOs that actually matched a gene, order-preserving
    — which also avoids the rxnMiriams index misalignment in the MATLAB pruning.
  • Default model.id. When no model_id is given, the draft's id defaults to the FASTA
    stem instead of inheriting the reference model's id (RAVEN always sets model.id). Pass
    model_id explicitly for byte-identical parity with a specific MATLAB organismID.
  • Neutral reaction note (Included by KEGG HMM reconstruction).

No behaviour change to the organism-annotation path or to default keepSpontaneous=true
runs; assign_kos scoring/filters are unchanged.

MATLAB counterpart

The remaining parity items are applied on RAVEN develop3 (separately): pass
-Z <nprofiles> to hmmsearch (E-value scale the cut-offs are calibrated against),
keep gene-supported spontaneous reactions under keepSpontaneous=false, fix the
kegg.orthology prune alignment, sort grRule genes, and use the neutral note.

Testing

Full suite: 829 passed, 4 skipped. Adds tests for the orthology prune and the model.id
default.

Bring the protein-FASTA reconstruction (get_kegg_model_from_sequences)
into byte-parity with RAVEN develop3 getKEGGModelForOrganism:

- Prune each gene-backed reaction's kegg.orthology annotation to the KOs
  that actually matched a gene, via a new prune_orthology flag on
  assemble_model_from_ko_genes (off by default, so the organism-annotation
  path keeps the full KO list). The order-preserving intersection also
  avoids the rxnMiriams index misalignment in the MATLAB pruning.
- Default model.id to the FASTA stem when no model_id is given, so the
  draft never inherits the reference model's id.
- Use a neutral reaction note ("Included by KEGG HMM reconstruction").

Note: the hmmsearch -Z parity item is handled on the MATLAB side (Python's
-Z <nprofiles> matches the hmmscan scale the K15 cut-offs were calibrated
against).
@edkerk
edkerk merged commit 7b389c4 into develop Jul 18, 2026
8 checks passed
@edkerk
edkerk deleted the fix/kegg-fasta-parity branch July 18, 2026 20:55
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