auto-triage: guard bio1 objective assignment in reconstruct (issue #23)#4
Draft
jplfaria wants to merge 1 commit into
Draft
auto-triage: guard bio1 objective assignment in reconstruct (issue #23)#4jplfaria wants to merge 1 commit into
jplfaria wants to merge 1 commit into
Conversation
Models built from non-standard templates may not have a 'bio1' reaction, causing ValueError: invalid objective at save time. Use _set_biomass_objective() which falls back to the first biomass-like reaction and silently skips if none is found. Fixes ModelSEED/modelseed-api-ops#23 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
model.objective = "bio1"in thereconstructtask with_set_biomass_objective()helper that falls back gracefully whenbio1is absent.job_scripts/reconstruct.py.try/exceptat line 1266 oftasks.pyin favour of the shared helper.Root cause
build_metabolic_modeldoes not guarantee the biomass reaction is always namedbio1. For models built from non-standard templates or sparse genomes the biomass reaction may be named differently (bio2,BIOMASS_*, etc.), causingcobrato raiseValueError: invalid objective.Fixes ModelSEED/modelseed-api-ops#23
Test plan
tests/unit/test_set_biomass_objective.pycover: bio1 present, bio1 absent with fallback, no biomass reactions (silent skip), empty model.pytest tests/unit/locally.