Repository navigation
Conversation
MSCommunity @ 2dcff16 targets the freiburgermsu/ModelSEEDpy lineage and fails against cshenry/ModelSEEDpy main, the tree KBUtilLib builds on. Fixed here with no invented modelling semantics: - commhelper: import minimizeFlux_withGrowth/bioFlux_check from modelseedpy.core.msminimalmedia, NoFluxError/ObjectiveError from modelseedpy.core.exceptions; they are not re-exported from modelseedpy.core. - commhelper/mskineticsfba: FBAHelper.isnumber is gone; restored as a module-level isnumber copied from modelseedpy datastandardization. - mscommsim: FBAHelper.mediaName -> medianame (exact rename). - commhelper: the nonMSID lookahead was evaluated eagerly but can only match an id ending in digits and is unused on the branch that non-ModelSEED ids always take; it raised AttributeError on .group() for every such id. Now evaluated only where used. - commhelper: make_model_util() adapts MSModelUtil's signature. copy= is honoured locally when unsupported (dropping it would mutate the caller's models); environment/climit/o2limit RAISE when non-default, since dropping an uptake limit would yield plausible wrong fluxes. climit/o2limit exist in no reachable ModelSEEDpy. INCOMPLETE: ~11 MSModelUtil members are still missing (add_objective, create_constraint, add_minimal_objective_cons, carbon_exchange_list, exchange_mets_list, add_medium, run_fba, remove_cons_vars, metabolites_set, standard_exchanges, remove_constraint). No live community test passes yet. rxn_mets_list and solution_to_variables_dict remain unported; both sit only in phenotypes(), never called by KBUtilLib.
…ersion Completes the port begun in 58f0970. Community modeling now runs end to end on real ModelSEED models. - CompatModelUtil(MSModelUtil) restores the members MSCommunity needs that cshenry/ModelSEEDpy main lacks: metabolites_set, exchange_mets_list, carbon_exchange_list, carbon_exchange_mets_list, standard_exchanges, add_cons_vars, remove_cons_vars, create_constraint, remove_constraint, add_objective, add_minimal_objective_cons, add_medium, run_fba. All ported from the freiburgermsu lineage (branch MSpy_freiburgermsu) except remove_constraint, whose contract is derived from its call sites. Two deliberate deviations, noted at their sites: Objective/Constraint come from self.model.problem rather than bare optlang, so they bind to the model's own solver interface. - add_medium now ports FBAHelper.convert_kbase_media (absent from the installed ModelSEEDpy) so an MSMedia is accepted: uptake bound is the NEGATED lower bound, matching cobra's model.medium convention. A medium that is neither a mapping nor an MSMedia still RAISES -- applying no medium instead would silently leave the model unconstrained, which is exactly how a no-carbon control turns into a false positive. VERIFIED on two real E. coli members (gf.json from the 2026-10-01 acceptance run, glpk; pod gurobi is size-limited and refuses a genome-scale LP): build_community -> CommunityModel, members c1/c2, abundances 0.5/0.5 community FBA -> status optimal, community_growth 1.1706, kinetics NOT relaxed, 171 exchange fluxes gmm WITH carbon -> 1.1706 gmm NO carbon -> 0.0 <- control passes cross_feeding_table-> two DataFrames (24,3) and (3,3) Still unported: rxn_mets_list and solution_to_variables_dict, both only inside phenotypes(), which KBUtilLib never calls; the latter has no reachable original so porting it would mean guessing.
- commhelper.CompatModelUtil.create_constraint: accept printing= (c3259f3 dropped it; mscommsim passes it at four sites, so predict_abundances raised TypeError). - CompatModelUtil.remove_constraint: a name beginning with "_" also removes every constraint whose name ends with it. regularization() creates <member>_regularization and clears them with remove_constraint( "_regularization"); the exact-match contract left them in place, so the next ratio pass or the next predict_abundances call raised ContainerAlreadyContains. - CommunityMember.compute_max_biomass/compute_max_atp: optimize via self.community.util.model; MSCommunity has no .model attribute. - test_individual_species: store objective_value, not the Solution object, in the Biomass/ATP columns. - _compute_relative_abundance_from_solution(update_abundances=True): pass set_abundance the {id: {"abundance": x}} shape it reads (bare floats raised IndexError; also present on main since 2d37cd4). Verified: KBUtilLib tests/modeling/test_ms_community_utils_live.py goes from 2 failed / 7 passed to 1 failed / 8 passed / 1 skipped. The remaining failure is a symmetric test fixture (two identical members predict the uniform default split), not this code. Co-Authored-By: Claude Opus 5.5 <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
MSCommunity at
2dcff16targets the freiburgermsu/ModelSEEDpy lineage and fails against cshenry/ModelSEEDpymain, which is the tree KBUtilLib builds on. This branch ports it across without adding any new modelling behaviour.modelseedpy.core.msminimalmedia,modelseedpy.core.exceptions), plus a restoredisnumberand themediaName→medianamerename. Also adds amake_model_util()signature adapter. Any non-defaultenvironment/climit/o2limitnow raises instead of being silently dropped.CompatModelUtil(MSModelUtil)restores the 11MSModelUtilmembers MSCommunity needs. It also portsconvert_kbase_mediasoadd_mediumaccepts anMSMedia, and an unrecognised medium raises rather than leaving the model unconstrained.create_constraint(printing=)remove_constraintsuffix semantics for_regularizationcompute_max_biomass/compute_max_atpreadself.community.util.modelset_abundancepayload shapeVerification
tests/modeling/test_ms_community_utils_live.py, using the ModelSEED-shaped asymmetric fixture: 9 passed, 1 skipped. The skip is the no-QP refusal path, which can't run because a QP solver is present.Not ported
rxn_mets_listandsolution_to_variables_dictwere not ported. Both are used only insidephenotypes(), which KBUtilLib never calls.🤖 Generated with Claude Code