torchcell.metabolism

Genome-scale metabolic modeling. yeast_GEM wraps the yeast-GEM model (through cobra) and derives its reaction and metabolite graphs; constraints turns a genome-scale model into constraint tensors; flux_layer is a differentiable, enzyme-constrained flux layer; media maps an ontology Media object onto exchange bounds; pathway adds a heterologous pathway to a model as a typed perturbation; and enzyme_kinetics and parameters hold kinetic parameters with their provenance. Nothing is re-exported at the package level, because yeast_GEM imports cobra and downloads the model on first use; import the submodule you need.

betaxanthin

The betaxanthin cassette Cachera transferred into the yeast knockout collection.

Functions

betaxanthin.build_betaxanthin_pathway

Build the cassette as a pathway object against one genome-scale model.

betaxanthin.betaxanthin_demand_ids

Demand reactions whose flux sums to the measured yellow pigment.

constraints

Genome-scale model -> constraint tensors, as pure functions of a GEM.

Classes

constraints.ThermoMode

How the flux layer forms its reaction potential.

constraints.TableCoverage

How much of a parameter table is real, stated rather than assumed.

constraints.ThermoTable

Standard transformed Gibbs energies for one GEM, with provenance.

constraints.CatalyticUnits

The GPR, flattened into AND-terms, as index arrays rather than strings.

constraints.GemTensors

A genome-scale model as tensors: stoichiometry, bounds, GPR, thermodynamics.

Functions

constraints.load_thermo_table

Load \(\Delta_f G'^\circ\) / \(\Delta_r G'^\circ\) from a GEM checkout.

constraints.parse_catalytic_units

Flatten every GPR into AND-terms indexed against rxn_ids.

constraints.independent_balance_rows

Pick a maximal set of linearly independent rows of S.

constraints.null_space_basis

An orthonormal basis \(\mathcal{N}\) of \(\ker S\), so \(S\mathcal{N}=0\).

constraints.build_gem_tensors

Extract every constraint tensor from a cobra model.

constraints.compare_reaction_delta_g

Check the recomputed \(\Delta_r G'^\circ\) against the shipped column.

enzyme_kinetics

Enzyme kinetic parameters (k_cat, K_M) with provenance, from the Open Enzyme Database.

Classes

enzyme_kinetics.KineticKind

Which constant is being resolved.

enzyme_kinetics.KineticSource

Where a value came from.

enzyme_kinetics.KineticRetrieval

Provenance for one retrieved OED slice.

enzyme_kinetics.OedKineticRecord

One OED row, kept verbatim.

enzyme_kinetics.ResolvedKineticParameter

A single parameter chosen for a (protein, substrate) pair, with its audit trail.

Functions

enzyme_kinetics.fetch_oed_records

Page the OED /data endpoint for one organism.

enzyme_kinetics.mirror_oed_slice

Fetch an organism slice, write it with a sha256-pinned provenance record.

enzyme_kinetics.load_mirrored_records

Read the mirror and VERIFY its sha256 before returning anything.

enzyme_kinetics.resolve_parameter

Choose one value from many measurements, by the documented cascade.

enzyme_kinetics.index_by_uniprot

Group rows by UniProt accession, the key the GPR maps yeast genes onto.

flux_layer

A differentiable, enzyme-constrained, thermodynamically-feasible flux layer.

Classes

flux_layer.CompartmentParameters

pH, ionic strength and membrane potential per compartment.

flux_layer.FluxLayerConfig

Every switch the flux layer has, in one place so a run records what it ran.

flux_layer.FluxLayer

Gene tokens in, a feasible flux vector and its feasibility residuals out.

Functions

flux_layer.gene_index_map

Map GEM gene positions onto the model's gene-token positions.

media

Map an ontology Media object onto genome-scale-model exchange bounds.

Classes

media.UptakePolicy

Magnitudes assigned to an uptake bound, by the component's functional role.

media.ExchangeBound

One exchange reaction opened to an uptake magnitude, with its provenance.

media.ComponentResolution

What became of one ontology component on the way to a bound vector.

media.MediaBounds

A medium expressed as exchange bounds for one specific model.

media.MediaBoundsDiff

Exchange-level difference between two bound vectors on the same model.

media.ExchangeIndex

Lookup tables built once from a model's exchange reactions.

Functions

media.build_exchange_index

Index a model's exchange reactions by annotation identifier and by name.

media.resolve_component

Place one ontology component on zero or more exchange reactions.

media.media_to_bounds

Map an ontology Media onto exchange bounds for model.

media.diff_bounds

Exchange-level difference between two bound vectors.

parameters

Kinetic and physical parameters for a GEM, database-first and provenance-tagged.

Classes

parameters.ParameterProvenance

Where one parameter value came from.

parameters.KcatPredictor

A sequence-based turnover predictor.

parameters.PredictorRegistry

The predictors a run is allowed to use, in priority order.

parameters.ParameterTable

One resolved parameter per entity, with a per-entity provenance tag.

Functions

parameters.load_swissprot

Read data/databases/swissprot.tsv, keyed by systematic ORF name.

parameters.molecular_weight_table

Per-gene molecular weight in kDa, from SwissProt.

parameters.uniprot_for_genes

Systematic ORF name -> UniProt accession, the join key into any kinetics database.

parameters.resolve_kcat_table

One \(k_{cat}\) per catalytic unit, database-first.

parameters.load_measured_concentrations

ChEBI id -> measured intracellular concentration in molar, from YMDB.

parameters.concentration_prior

Per-metabolite measured concentration prior, in molar, plus its coverage mask.

pathway

Add a heterologous pathway to a genome-scale model, as a typed perturbation.

Classes

pathway.EvidenceTier

Where a coefficient came from, so a guess can never read as a measurement.

pathway.MetaboliteSpec

A metabolite the genome-scale model does not have yet.

pathway.ReactionSpec

A reaction the genome-scale model does not have yet.

pathway.HeterologousPathway

A named set of metabolites, reactions and genes added to a base strain.

Functions

pathway.apply_pathway

Add a pathway's metabolites, reactions and genes to a genome-scale model.

yeast_GEM

Wrapper around the yeast-GEM metabolic model and its derived graphs.

Classes

yeast_GEM.MemberlessReactionError

A reaction with no metabolites, which neither graph view can represent.

yeast_GEM.YeastGEM

Download, load, and expose the yeast-GEM genome-scale model.

Functions

yeast_GEM.plot_reaction_map

Plot hypergraph for a specific reaction.

yeast_GEM.plot_full_network

Plot the entire metabolic network structure without labels.

yeast_GEM.plot_random_network

Plot a random subgraph of the metabolic network and save it.

yeast_GEM.plot_bipartite_network

Plot a bipartite network visualization of genes to metabolites.

yeast_GEM.sanity_check_metabolic_networks

Print details for a few random reactions as a sanity check.

yeast_GEM.analyze_reactions_without_genes

Analyze reactions without gene associations in the YeastGEM model.

yeast_GEM.test_bipartite_attributes

Test and display the new attributes added to the bipartite graph.