Model adapter (Python)#
geckopy objects in geckopy.adapter.
Functions#
Function |
Summary |
|---|---|
Hyperparameters for kcat tuning against experimental data. |
|
Generate a commented TOML template for a new ecModel project. |
|
How kcats are assigned from the kcat source files ( |
|
One |
|
Settings that only GECKO (MATLAB) reads; geckopy ignores them. |
|
Holds the organism-specific parameters and overridable |
|
Top-level parameters for an ecModel adapter. |
|
OpenKineticsPredictor settings (used by submit/fetch_open_kinetics_predictor). |
|
Return the adapter to use, falling back to |
|
Return an explicit value, else fall back to |
|
One trust-tier entry in |
|
Which reactions proceed without an enzyme. |
|
Reference#
ComplexParams#
EvotuneParams#
Hyperparameters for kcat tuning against experimental data.
Sources not matched by any source_groups entry fall back to the
*_default fields (matching MATLAB's noKcatSource behaviour:
sigma0logDefault etc. apply to every kcat first, then only ones
with a recognised source get overridden by their group's value).
generate_template_toml#
generate_template_toml(*, project_name: str='my-ecmodel')
Generate a commented TOML template for a new ecModel project.
Every section of the schema is emitted, evotune kcat tuning hyperparameters included; optional fields are commented out at their defaults, so the template doubles as the reference for what can be set.
Parameters
project_nameName written into the template's header comment.
Returns
strThe full TOML template text, ending in a newline.
KcatAssignmentParams#
How kcats are assigned from the kcat source files (collect_kcats).
KcatStageParams#
One [[kcat_assignment.stage]]: decides each reaction that is still
open, by the first listed source with a value (select) or by all
listed sources with a value, weighted by their reliability
(combine).
KeggParams#
MatlabParams#
Settings that only GECKO (MATLAB) reads; geckopy ignores them.
They let one model_adapter.toml configure both tools.
ModelAdapter#
Holds the organism-specific parameters and overridable
helpers for one ecModel project.
Most users don't subclass this directly: they make a folder
with a model_adapter.toml and call
ModelAdapter.from_folder(folder).
Subclass only when a particular organism needs custom logic (e.g. an unusual way to identify spontaneous reactions, or a bespoke gene-id mapping that the default UniProt-table-driven one can't handle).
ModelParameters#
Top-level parameters for an ecModel adapter.
OkpParams#
OpenKineticsPredictor settings (used by submit/fetch_open_kinetics_predictor).
The API key is intentionally NOT here (it is a secret): provide it as a
function argument, the OKP_API_KEY environment variable, or the file
<path>/data/okpApiKey.txt.
resolve_adapter#
resolve_adapter(model, adapter: Optional['ModelAdapter']=None, *, purpose: str='this function')
Return the adapter to use, falling back to model.adapter.
Parameters
modelAny object that may have an
.adapterattribute (a cobra Model, an EcModel, ...).getattris used so plaincobra.Modeldoesn't trip on the missing attribute.adapterAn explicitly-passed adapter. If non-None, returned as-is (takes priority over
model.adapter).purposeShort description of why the calling function needs an adapter; included in the error message when none can be resolved. Example:
"to read params.enzyme_comp".
Returns
ModelAdapterEither
adapter(if given) ormodel.adapter.
Raises
ValueErrorIf both
adapterandmodel.adapterareNone. The message tells the caller how to fix it.
resolve_param#
resolve_param(model, explicit, attr: str, *, adapter: Optional['ModelAdapter']=None, purpose: str='this function')
Return an explicit value, else fall back to adapter.params.<attr>.
Lets a function take the single parameter it needs directly, only
requiring a full ModelAdapter when the value is not supplied.
Parameters
modelAny object that may have an
.adapterattribute, used as the fallback source whenadapteris not given.explicitThe caller-supplied value. If not
None, it is returned as-is and no adapter is consulted at all.attrName of the attribute to read off
adapter.paramswhenexplicitisNone.adapterAn explicitly-passed adapter, used instead of
model.adapterwhen resolving the fallback value.purposeShort description of why the calling function needs the value; forwarded to
resolve_adapterfor its error message.
Returns
```explicitif given, otherwisegetattr(adapter.params, attr)``.`
:
SourceGroupRule#
One trust-tier entry in EvotuneParams.source_groups.
ec.source holds literal strings like "dlkcat", "brenda",
and -- for OpenKineticsPredictor kcats -- the raw predictor method
name (e.g. "CataPro"), not a generic "okp" tag. A rule
matches a given ec.source value if it's listed in sources,
or (when match_okp is True) if it equals the project's
configured OKP method (OkpParams.method).
SpontaneousParams#
Which reactions proceed without an enzyme.
Both rules may be given; a reaction is spontaneous if either matches. GECKO (MATLAB) reads the same keys, so a project needs no code for this.