Skip to content

Releases: CompMetEng/geckopy

v4.0.0b1

Choose a tag to compare

@edkerk edkerk released this 08 Sep 21:24
277b74a

Version realignment: geckopy numbering will be aligned with GECKO (MATLAB),
justifying a jump to 4.x. This is the first release published to PyPI.

  • New: kcat_tuning.evotune fits ec.kcat to measured growth rates and
    exchange fluxes with CMA-ES (screen_kcat_leverage, select_tunable_mask,
    cmaes_kcat_tuning, tune_prior_penalty_weight), replacing the earlier
    ABC-SMC approach. EvotuneResult.corrections() reports a tuning run as a
    ranked table of what changed and why, rather than a raw kcat vector. Gated
    behind the new evotune extra.
  • New: gather_kcats.review.review_assignment flags kcat-assignment
    problems (repeated values, EC-maximum fallback, implausible magnitude)
    worth curating before a tuning run.
  • kcat_sensitivity_analysis renamed to kcat_tuning, with the CMA-ES
    subpackage named evotune rather than bayesian — the shipped method is
    CMA-ES, not Bayesian inference.
  • flexibilize_enz_concs: the post-loop refinement now uses MATLAB's soft
    ±0.25% growth band instead of pinning to exp_growth exactly, matching
    flexibilizeEnzConcs.m.
  • make_ec_model no longer splits exchange reactions in the irreversibility
    stage, matching makeEcModel.m's nonExchRxns exclusion.
  • get_reactions_from_enzyme now matches protein_id case-insensitively,
    matching MATLAB's strcmpi.
  • read_dlkcat_output gained an opt-in strict=True fail-fast on
    unrecognized substrates, matching MATLAB, and now reports drop reasons
    separately instead of lumping them together.
  • assign_standard_kcat: a NaN-kcat reaction no longer counts toward a
    subsystem's threshold eligibility or gets folded into the subsystem
    median; unset kcats now get filled for NaN too, not just literal zeros.
  • parse_okp_output now tags provenance with the OKP- prefix MATLAB
    applies; merge_kcats strips it again before source-priority matching so
    tagged rows still rank correctly.
  • set_kcat_for_reactions now accepts a per-isozyme kcat list against an
    un-suffixed base name (assigned positionally, matching MATLAB), and writes
    ec.source = "setKcatForReactions" (MATLAB's actual value) instead of
    "manual".
  • ec_fseof: scan floor now anchors to the production target's flux at
    biomass-optimum instead of a fixed fraction of the theoretical maximum,
    and candidates are restricted to gene-associated, non-standard reactions
    before classification — both matching ecFSEOF.m.
  • ec_fva's parallel path now uses cobra.util.process_pool.ProcessPool
    instead of a hand-rolled multiprocessing.Pool — fixes a slow Windows
    initializer handoff and gives graceful pool teardown. Public signature
    unchanged.
  • raven-toolbox dependency switched from a git+...@develop pin to the
    PyPI >=3.0.0b1 release, which carries the convert_to_irreversible(..., rxns=...) addition make_ec_model needs.
  • Packaging: the sdist was bundling the entire local .venv-win
    virtualenv (~60MB, including a compiled scipy wheel) because .gitignore
    listed .venv/ but not .venv-win/, and hatchling's default sdist
    selection only reads the top-level .gitignore.
  • release.yml: PyPI publish job enabled (trusted publishing).
  • README: disambiguation note simplified and repointed at the specific old
    geckopy release (2.0.2 and earlier), now that this project has taken
    over the PyPI project name itself.

Full changelog: https://github.com/SysBioChalmers/geckopy/blob/main/CHANGELOG.md
Compare: v0.3.0...v4.0.0b1

v0.3.0

Choose a tag to compare

@edkerk edkerk released this 30 Aug 20:15
ac0f475

Parity pass against the MATLAB GECKO Toolbox: geckopy's core functions now reproduce every value GECKO's own unit-test suite pins down.

Added

  • tests/test_gecko_matlab_parity.py — a 1:1 port of GECKO's test/unit_tests/geckoCoreFunctionTests.m (47 tests, MATLAB test cases tc0001–tc0013), run against the same ecTestGEM fixture MATLAB uses. Every expected value is copied verbatim from the MATLAB sources rather than re-derived from geckopy's output, so the file is the executable definition of "geckopy builds the same ecModel as GECKO". It needs no MATLAB to run and covers makeEcModel (full and light), applyComplexData, setProtPoolSize, getECfromGEM, getECfromDatabase, save/load round-trip, fuzzyKcatMatching, writeDLKcatInput, mergeDLKcatAndFuzzyKcats, selectKcatValue, applyKcatConstraints, getKcatAcrossIsozymes, applyCustomKcats, findMetSmiles and the proteomics-integration chain.

Fixed

  • make_ec_model sorts identifiers for full models, as MATLAB makeEcModel does (sortIdentifiers, line 203, full models only, before the protein pseudoreactions are appended). geckopy kept the input GEM's reaction order, so a full ecModel came out with the same reactions in a different order from MATLAB's — visible in the saved YAML and in every downstream table that follows ec.rxns order.
  • write_dlkcat_input emits rows in reaction order, matching MATLAB's column-major find(clearedRedS < 0). numpy's where is row-major, so geckopy grouped the DLKcat input by substrate instead of by reaction.
  • EcModel.copy() clones the ec substructure. cobra.Model.copy rebuilds the network but carries every other attribute over by reference, so model.copy().ec was the same EcData object as model.ec: writing a kcat, eccode, source, conc or coupling coefficient on the copy silently changed the model it was copied from. The copy's enzymes view was likewise still bound to the original model, so reads and writes through model.enzymes went to the wrong model. copy() now clones ec and rebinds enzymes, giving the value semantics MATLAB GECKO has throughout. adapter stays a shared reference (project configuration, not model state). copy.deepcopy(model) was already correct and is unchanged.
  • Reverse (_REV) reactions keep their EC code, via a fix in raven-toolbox's convert_to_irreversible (it now copies annotations, subsystem and notes onto the reverse reaction, as MATLAB's convertToIrrev copies eccodes / rxnMiriams / subSystems / rxnNotes). Without it fill_eccodes_from_gem returned '' for every _REV reaction, fuzzy BRENDA matching found no kcat, and reverse directions were left unconstrained. Requires raven-toolbox at or after that fix.
  • copy.deepcopy(ec_model) (and of any cobra.Model) no longer RecursionErrors on Python 3.14. The cause was in cobra, not geckopy: Reaction.__copy__/__deepcopy__ delegated to super() as a way to avoid infinitely recursing into themselves, but that trick relies on copy memoizing an object before recursing into its state, and Python 3.14's copy module no longer does so for that code path. Every reaction holds its metabolites and every metabolite holds the reactions it participates in, so the resulting cycle exists in any real model, full ecModels included — deep-copying one recursed until the interpreter's recursion limit gave out. Fixed upstream in cobra 0.31.0 by deleting the overrides; requires cobra at or after 0.31.1.
  • examples/yeast-GEM's adapter config used a rejected pydantic field. model_adapter.toml set uniprot.tax_id, but ModelParameters's schema (additionalProperties=false) has no such field — it's called id, and already defaults to the taxonomy id — so ModelAdapter.from_folder raised a validation error on this folder unconditionally. A parametrized regression test now runs over every examples/ subfolder so schema drift like this is caught for any future adapter config too. (#34)

Documentation

  • Docstrings across geckopy's source and tests reviewed for clarity and accuracy: MATLAB-COMPAT comparison paragraphs replaced with plain statements of current behavior, other historical/regression narration dropped, and several docstrings that no longer matched the code corrected. Comment/docstring-only; no functional changes. (#36)
  • protein_pool.py's module docstring no longer claims prot_pool_exchange's direction diverges from MATLAB pending a "future I/O layer". GECKO MATLAB's makeEcModel.m already writes the same forward (lb=0, ub=1000) convention as geckopy; the reverse convention only applies to legacy pre-GECKO-4 files, which load_ec_model.py already normalizes on load. (#38)
  • mw.py's stale MATLAB-COMPAT comments removed now that calculate_mw matches GECKO MATLAB's current water-mass constant (18.01528) and mean X-residue mass (118.885), closed upstream as GECKO#459. No behavioral change — the code already computed the now-matching values. (#39)

Internal

  • Removed the dead _run_preprocess stub from test_populate_ec: an empty helper (docstring and comments, no body) that was never called. The preprocessing stages it described are already exercised elsewhere. (#37)

Notes

  • merge_kcats is n-ary and concatenates surviving rows list by list, so the equivalent of MATLAB's mergeDLKcatAndFuzzyKcats(dlkcat, fuzzy) — which always emits fuzzy rows first regardless of argument order — is merge_kcats(fuzzy, dlkcat, ...). The deprecated merge_dlkcat_and_fuzzy_kcats alias is merge_kcats, so it follows the geckopy convention, not MATLAB's signature. Row order has no numerical effect: apply_kcat_list aggregates per reaction.

Full changelog: https://github.com/SysBioChalmers/geckopy/blob/main/CHANGELOG.md
Compare: v0.2.1...v0.3.0

v0.2.1

Choose a tag to compare

@edkerk edkerk released this 16 Jul 17:50
3a437fe

Bugfix release. make_ec_model no longer mutates the GEM it is given.

Fixed

  • make_ec_model leaves the input GEM unchanged. Stages 1–5 (remove_pseudoreaction_gprs, invert_backwards_only_reactions, convert_to_irreversible, expand_model) ran in place on the caller's model, leaving it with _REV / _EXP_ reaction splits, prot_ pseudometabolites, and stripped pseudoreaction GPRs. The pipeline now works on an internal model.copy(), matching MATLAB GECKO's makeEcModel value semantics. (#32)
  • test_loads_sbml_gem on Windows: the test wrote a backslash path into the adapter TOML, which TOML reads as an escape sequence.

Documentation

  • README: disambiguation note stating that this geckopy is a from-scratch port of the MATLAB GECKO Toolbox, unrelated to and sharing no code with the separate PyPI geckopy package described in Carrasco Muriel et al. (2023).

Internal

  • CI: leaner test matrix — full Python range (3.11–3.13) on Linux plus a single Python (3.12) on macOS and Windows, instead of the full 3×3 OS × Python grid. Same OS coverage at roughly half the runner cost. (#31)
  • Removed unused test imports flagged by ruff (F401).

Full changelog: https://github.com/SysBioChalmers/geckopy/blob/main/CHANGELOG.md
Compare: v0.2.0...v0.2.1

geckopy 0.2.0

Choose a tag to compare

@edkerk edkerk released this 13 Jun 22:51
90ad16a

Dependency rename + CI hardening. geckopy now targets raven-toolbox (the renamed raven-python) and runs its test matrix on every pull request.

Changed

  • Depend on raven-toolbox (renamed from raven-python): all imports are now raven_toolbox.*, and the pyproject.toml git-URL dependency and project URL point at SysBioChalmers/raven-toolbox. (#29)
  • Use the public raven_toolbox.manipulation.expand.gpr_to_dnf instead of the former private _gpr_to_dnf. (#26)
  • CI: run the test matrix on every pull request, not only PRs into main/master.
  • CI: bump GitHub Actions to Node 24 runtimes — checkout@v5, setup-python@v6, upload-artifact@v7, download-artifact@v8. (#27)

Documentation

  • Rewrote migrating_from_gecko_matlab.md as a complete reference (#25); moved internal planning notes into docs/internal/ (#28).

Install (PyPI publishing is not yet enabled — see the README):

pip install "geckopy @ git+https://github.com/SysBioChalmers/geckopy.git@v0.2.0"

geckopy 0.1.0a3 (second alpha)

Pre-release

Choose a tag to compare

@edkerk edkerk released this 30 May 21:16
72f4ad2

Second public alpha. Layering pass: the bits of geckopy that aren't GECKO-specific moved into raven-python, and gecko-light ecModels are now buildable end-to-end. Repo housekeeping for a discoverable first GitHub release.

(v0.1.0a2 was tagged earlier but its release.yml build failed — hatchling rejected the raven-python @ git+https://... direct reference. v0.1.0a3 carries the same content with the one-line [tool.hatch.metadata] allow-direct-references = true fix.)

Install

pip install \
    git+https://github.com/SysBioChalmers/raven-python.git@develop \
    git+https://github.com/SysBioChalmers/geckopy.git@v0.1.0a3

raven-python is not yet on PyPI; geckopy's PyPI name is currently taken by another project. Both currently install from git.

Highlights

  • gecko-light ecModel end-to-end (#20) — make_ec_model(gecko_light=True) produces a working light ecModel; cobra reactions stay singular and per-isozyme coupling lives in ec.rxns as duplicate rows with a ###_ counter prefix. apply_kcat_constraints picks the lowest-cost isozyme per cobra reaction. New tutorials/light_ecModel/protocol.py + opt-in Human-GEM smoke test (pytest -m smoke, ~2.5 min). See docs/gecko_light_status.md.
  • YAML I/O + typed EcData delegated to raven-python (#19) — save_ec_model / load_ec_model are now ~80-LOC wrappers around raven_python.io.read_yaml_model / write_yaml_model. SBML ecModel I/O removed (cobra.io.read_sbml_model is still used for loading the conventional starting GEM). geckopy.EcData re-exports raven's EcData. See docs/raven_integration.md.
  • ec_fseof re-aligned with raven_python.analysis.fseof (#21) — thin wrapper over raven's regression-based FSEOF; selection moves from MATLAB GECKO's strict monotonicity + top-25 %-by-slope to |correlation| ≥ threshold with pFBA per step. Result type is raven's FSEOFResult; action labels are amplify/knockdown/knockout.
  • get_conc_control_coeffs solver-state guard fix — gates both shadow-price and finite-difference helpers on sol.status == "optimal"; previously accepted infeasible-LP states where glpk returns a non-NaN objective from the binding-constraint rhs.

Removed (breaking from 0.1.0a1)

  • geckopy.io.sbml.{read,write}_sbml_ec_model and the geckopy.io package.
  • geckopy.EcFseofResult (use raven_python.analysis.fseof.FSEOFResult).
  • Top-level requirements.txt (a pip freeze snapshot duplicating pyproject.toml).

Repo housekeeping (PRs #22, #23, #24)

  • MIT LICENSE text added at repo root (was only declared in pyproject.toml).
  • Internal planning docs moved from docs/ to docs/internal/ so the user-facing tree only carries reference documentation.
  • [tool.hatch.metadata] allow-direct-references = true so python -m build accepts the raven-python git URL dependency.
  • permissions: contents: write on the release.yml build job so softprops/action-gh-release can attach assets without HTTP 403.

Full notes: CHANGELOG.md § 0.1.0a3 + § 0.1.0a2.

geckopy v0.1.0a1 — first public alpha

Pre-release

Choose a tag to compare

@edkerk edkerk released this 29 May 22:28

First public alpha. Every MATLAB GECKO 3.2.5 function used in the standard ecModel build is ported; the yeast-GEM tutorial runs end-to-end. See CHANGELOG.md for the full PR-grouped list of changes.

Install

pip install \
    git+https://github.com/SysBioChalmers/raven-python.git@main \
    git+https://github.com/SysBioChalmers/geckopy.git@v0.1.0a1

geckopy depends on raven-python for shared model-manipulation primitives (expand_model, convert_to_irreversible). Neither is on PyPI yet — both install from GitHub.

Requires Python 3.11 or newer.

What's in this release

  • Build an enzyme-constrained model from a conventional GEM + adapter
  • Source kcats from BRENDA (fuzzy matching), DLKcat, OpenKineticsPredictor, or manual lists; merge across sources
  • Integrate proteomics, fit sigma, flexibilise enzyme concentrations
  • Analyse with parallel ecFVA, ecFSEOF, enzyme bottlenecks, control coefficients (shadow-price), pFBA on enzyme usage
  • Persist via YAML or SBML round-trip with ec_* metadata
  • Reproducible BRENDA snapshot refresh via geckopy brenda-refresh CLI
  • Full full_ecModel tutorial walking through yeast-GEM end-to-end

The build artefacts (sdist + wheel) will be attached by the release workflow shortly.