Skip to content

fix: unblock bulk-reconstruct code path (biochem_db parens + dead print_json_debug_file) - #46

Open
jplfaria wants to merge 1 commit into
cshenry:mainfrom
jplfaria:fix/bulk-reconstruct-build-bugs
Open

fix: unblock bulk-reconstruct code path (biochem_db parens + dead print_json_debug_file)#46
jplfaria wants to merge 1 commit into
cshenry:mainfrom
jplfaria:fix/bulk-reconstruct-build-bugs

Conversation

@jplfaria

Copy link
Copy Markdown
Contributor

Two latent bugs along the compute_ontology_model_changes -> build_metabolic_model -> _add_reactions_from_gene_mapping path. Neither has an active call site in the existing KBase-wrapped flows (kb_build_metabolic_models guards them out in practice), but they are hard-blocking the modelseed-api bulk-reconstruct endpoint which calls these primitives directly per the Phase 3 PRD path you'd suggested.

Bug 1: biochem_db called as a function

src/kbutillib/ms_reconstruction_utils.py:111

modelseeddb = self.biochem_db()

biochem_db is a @property (MSBiochemUtils:85), not a method. The parens call the returned ModelSEEDDatabase instance as a function and raise TypeError: 'ModelSEEDDatabase' object is not callable on the first reaction added via this path. Fix: drop the parens.

Bug 2: print_json_debug_file references with no definition

src/kbutillib/ms_reconstruction_utils.py:379, src/kbutillib/kb_model_utils.py:425, 600

self.print_json_debug_file(...)

print_json_debug_file is referenced 3 times but defined nowhere in the active code (only in kb_model_utils.py.bak, which isn't loaded). Any call path through compute_ontology_model_changes or save-without-workspace AttributeErrors immediately. The debug hook was leftover from a refactor; this PR drops the three calls. Re-add via the proper debug interface if needed later.

Verification

Verified end-to-end against poplar /api/jobs/bulk_reconstruct (KO-annotated test genomes) once both fixes were applied locally: model build succeeds, reactions.csv + genes.csv populated, COBRA JSON written to workspace.

🤖 Generated with Claude Code

…nt_json_debug_file)

Two latent bugs along the compute_ontology_model_changes -> build_metabolic_model
-> _add_reactions_from_gene_mapping path. Neither has an active call site in
the existing KBase-wrapped flows (kb_build_metabolic_models guards them out
in practice), but they are hard-blocking the modelseed-api bulk-reconstruct
endpoint which calls these primitives directly per Chris's guidance.

Bug 1: ms_reconstruction_utils.py:111
  modelseeddb = self.biochem_db()
biochem_db is a @Property (MSBiochemUtils, line 85), not a method. The
parens call the returned ModelSEEDDatabase instance as a function and
raise TypeError on the first reaction added via this path.

Bug 2: ms_reconstruction_utils.py:379 + kb_model_utils.py:425, 600
  self.print_json_debug_file(...)
print_json_debug_file is referenced 3 times but defined nowhere in the
active code (only in kb_model_utils.py.bak, which isn't loaded). Any
call path through compute_ontology_model_changes or save-without-workspace
AttributeErrors immediately. The debug hook was leftover from a refactor;
drop the calls. Re-add via the proper debug interface if needed later.

Verified end-to-end against poplar bulk_reconstruct (KO-annotated test
genomes) once both fixes were applied: model build succeeds, reactions.csv
+ genes.csv populated, COBRA JSON written to workspace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jplfaria
jplfaria force-pushed the fix/bulk-reconstruct-build-bugs branch from cf91762 to 1907ecc Compare July 21, 2026 22:11
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