Skip to content

feat: experiments, scipy solver support, protein MW, SMILES lookup and maintenance fit - #204

Draft
edkerk wants to merge 4 commits into
developfrom
feat/experiments
Draft

edkerk wants to merge 4 commits into
developfrom
feat/experiments

Conversation

@edkerk

@edkerk edkerk commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Generic functions that geckopy and the yeast-GEM maintenance fit need are in raven-toolbox, so that every model and the MATLAB side can use them. The MATLAB counterpart of the experiments package is in RAVEN (CompMetEng/RAVEN#28).

  • raven_toolbox.experiments: scores a model against measured growth rates and exchange fluxes.
    • load_experiment_data reads fluxData.tsv, maxGrowth.tsv and zeroFlux.tsv from a folder, and load_flux_data parses one flux file into a FluxData with a per-condition weight.
    • simulate_conditions fixes the uptake of each condition and solves the model. The anaerobic switch, the change of the protein content and the solver call are functions that the caller passes.
    • compute_carbon_weights and experiment_distance combine the carbon-weighted RMSE of the flux and max-growth conditions into one value.
    • apply_flux_data_constraints sets the exchange bounds of a model from one condition (loose, or a percentage band).
  • utils.solver: support for optlang's scipy (HiGHS) interface next to set_raven_tolerance: repair_scipy_problem, switch_to_scipy, edit_on_fast_solver, optimize_model and constraint_shadow_prices.
  • utils.protein.calculate_mw: molecular weight of a protein from its sequence.
  • annotation.find_met_smiles: fills the SMILES annotation of the metabolites from PubChem, with a local cache file.
  • biomass.fit_maintenance: fits NGAM from a maintenance coefficient and GAM from the substrate uptake of chemostats, with a study-weighted Huber loss and a bootstrap over studies. set_gam takes keep_offsets_of, and get_gam reads the coefficient. It is used by feat: fit GAM and NGAM from retentostats and chemostats SysBioChalmers/yeast-GEM#433.

The four commits are independent and can be reviewed one by one. geckopy uses the first three, and the PR for it waits for the release of this one.

The experiments package reads the flux files of several conditions, fixes the
uptake of each condition and solves the model, and combines the carbon-weighted
RMSE of the flux and max-growth conditions into one distance. The anaerobic
switch, the change of the protein content and the solver call are functions
that the caller passes. apply_flux_data_constraints sets the exchange bounds of
a model from one condition.
repair_scipy_problem, switch_to_scipy, edit_on_fast_solver, optimize_model and
constraint_shadow_prices work around the dense coefficient matrix, the stale
variable map and the missing solution status of the scipy interface, next to
set_raven_tolerance.
calculate_mw gives the molecular weight of a protein from its sequence.
find_met_smiles fills the SMILES annotation of metabolites from PubChem, with a
local cache file.
fit_maintenance fits NGAM from a maintenance coefficient and GAM from the
substrate uptake of chemostats, with a study-weighted Huber loss and a bootstrap
over studies. set_gam takes keep_offsets_of and get_gam reads the coefficient.

This branch has not been deployed

No deployments
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