5.1.1.1.2. etfba.core.model

Define the Model class.

5.1.1.1.2.1. Classes

Model

5.1.1.1.2.2. Module Contents

class etfba.core.model.Model(name=None)[source]
metabolites[source]

A dictionary mapping metabolite IDs to corresponding Metabolite objects.

Type:

PrettyDict

reactions[source]

A dictionary mapping reaction IDs to corresponding Reaction objects.

Type:

PrettyDict

end_metabolites[source]

A dictionary mapping metabolite IDs to Metabolite objects representing initial substrates or final products within the model.

Type:

PrettyDict

stoichiometric_matrix[source]

Represents the stoichiometric matrix where rows correspond to metabolites and columns correspond to net reactions. Negative values indicate substrates, while positive values denote products.

Type:

DataFrame

total_stoichiometric_matrix[source]

Represents the stoichiometric matrix where rows correspond to metabolites and columns correspond to total reactions (reversible reactions are split into forward and backward reactions). Negative values denote substrates, while positive values denote products.

Type:

DataFrame

transformation_matrix[source]

Matrix facilitating the conversion of total fluxes into net fluxes.

Type:

DataFrame

name[source]
_metabolites[source]
_reactions[source]
classmethod load(filename)[source]
Parameters:

filename (str) – Filename of the model file. The filename should end with the extension ‘.bin’.

save(filename)[source]
Parameters:

filename (str) – Filename of the model to save. The filename should end with the extension ‘.bin’.

static _set_value(value, default)[source]
_build_reactant(rxn, reacsStr, reackms, label)[source]
read_from_excel(filename)[source]
Parameters:

filename (str) – Filename of an Excel file containing the following fields: Enzyme, Substrates, Products, Sub Kms (mM), Pro Kms (mM), Fwd kcat (1/s), Bwd kcat (1/s), MW (kDa), and ΔrG’m (kJ/mol).

add_reactions(reactions)[source]
Parameters:

reactions (Reaction or list of Reactions) – Reaction objects to be added into the model.

remove_reactions(reactions)[source]
Parameters:

reactions (Reaction or list of Reactions) – Reaction objects to be removed from the model.

property metabolites[source]
property reactions[source]
_get_stoichiometric_matrix(metabolites, reactions)[source]
Parameters:
  • metabolites (tuple) – A tuple of metabolite IDs.

  • reactions (tuple) – A tuple of reaction IDs.

property stoichiometric_matrix[source]
_get_total_stoichiometric_matrix(metabolites, reactions)[source]
Parameters:
  • metabolites (tuple) – A tuple of metabolite IDs.

  • reactions (tuple) – A tuple of reaction IDs.

property total_stoichiometric_matrix[source]
_get_transformation_matrix(metabolites, reactions)[source]
Parameters:
  • metabolites (tuple) – A tuple of metabolite IDs.

  • reactions (tuple) – A tuple of reaction IDs.

property transformation_matrix[source]
property end_metabolites[source]
optimize(kind, *, objective=None, flux_bound=(0, 1000), conc_bound=(0.001, 100), spec_flux_bound=None, spec_conc_bound=None, preset_flux=None, preset_conc=None, preset_conc_ratio=None, irr_reactions=None, ex_conc=None, ex_mass_bal_cons=None, ex_thermo_cons=None, inc_enz_cons=None, enz_prot_lb=None, parsimonious=False, slack=0.001, dgpm_conf_level=None)[source]

Perform constraint-based optimization considering various constraints such as mass balance, thermodynamic, and enzyme protein allocation constraints.

Parameters:
  • kind ({'fba', 'tfba', 'efba', 'etfba'}) – Type of optimization to perform: - ‘fba’: Flux Balance Analysis with mass balance constraints only. - ‘tfba’: Flux Balance Analysis with both mass balance and thermodynamic constraints. - ‘efba’: Flux Balance Analysis with both mass balance and enzyme protein cost constraints. - ‘etfba’: Flux Balance Analysis with mass balance, thermodynamics, and enzyme protein cost constraints.

  • objective (dict) – Mapping of flux IDs to coefficients in the objective expression, e.g., {‘r1’: 2, ‘r2’: -1} defines the expression “2*r1 - 1*r2”. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • flux_bound (2-tuple) – Lower and upper bounds of metabolic fluxes in mmol/gCDW/h. Valid in ‘fba’, ‘tfba’, ‘efba’ and ‘etfba’.

  • conc_bound (2-tuple) – Lower and upper bounds of metabolite concentrations in mM. Valid in ‘tfba’ and ‘etfba’.

  • spec_flux_bound (dict) – Mapping of flux IDs to their bounds (lb, ub), where spec_flux_bound takes priority over flux_bound. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • spec_conc_bound (dict) – Mapping of metabolite IDs to their bounds (lb, ub), where spec_conc_bound takes priority over conc_bound. Valid in ‘tfba’ and ‘etfba’.

  • preset_flux (dict) – Mapping of flux IDs to fixed metabolic fluxes, e.g., substrate update rates. preset_flux takes priority over flux_bound. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • preset_conc (dict) – Mapping of metabolite IDs to fixed metabolite concentrations, e.g., substrate concentrations in the media. preset_conc takes priority over conc_bound. Valid in ‘tfba’ and ‘etfba’.

  • preset_conc_ratio (dict) – Mapping of ratio IDs to fixed ratios of metabolites. Ratio ID has the format “metabid:metabid”. Valid in ‘tfba’ and ‘etfba’.

  • irr_reactions (list) – List of irreversible reaction IDs. irr_reactions is prioritized in defining reversibilities. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • ex_conc (list) – List of metabolite IDs excluded from optimization. Valid in ‘tfba’ and ‘etfba’.

  • ex_mass_bal_cons (list) – List of metabolite IDs excluded from mass balance constraints. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • ex_thermo_cons (list) – List of reaction IDs excluded from thermodynamics constraints. For reversible reactions, both forward and backward reactions are excluded. Valid in ‘tfba’ and ‘etfba’.

  • inc_enz_cons (list) – List of reaction IDs included in enzyme protein cost constraints. Default values are used for missing kinetic parameters of Km, kcat, and MW. Valid in ‘efba’ and ‘etfba’.

  • enz_prot_lb (float) – Upper bound of enzyme protein fraction in g/gCDW. Valid in ‘efba’ and ‘etfba’.

  • parsimonious (bool) – Whether to further calculate parsimonious fluxes while maintaining the objective no worse than that obtained by conventional flux balance analysis. It may take longer to compute but could be useful for eliminating loops. Valid in ‘fba’, ‘tfba’, ‘efba’, and ‘etfba’.

  • slack (float) – Small nonnegative constant used to relax the objective constraint in parsimonious FBA. The objective is required to be no less than (1-slack)*opt_obj. Considering adjusting slack if parsimonious FBA encounters difficulties in finding feasible solutions. Valid in ‘fba’, ‘tfba’, ‘efba’ and ‘etfba’.

  • dgpm_conf_level (float) – If dgpm_conf_level is set, the standard reaction Gibbs energy is allowed to vary between [dgpm - z*error, dgpm + z*error], where dgpm and error are the standard reaction Gibbs energy and its error, and z is determined by dgpm_conf_level. Valid in ‘tfba’ and ‘etfba’.

  • (deprecated) (use_initial_concs) – Initial values of fluxes; optimization will be performed without initials if None. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid only in ‘etfba’.

  • (deprecated) – Initial values of concentrations; optimization will be performed without initials if None. Valid only in ‘etfba’.

evaluate_variability(kind, *, objective=None, obj_value=None, gamma=1, flux_bound=(0, 100), conc_bound=(0.001, 10), spec_flux_bound=None, spec_conc_bound=None, preset_flux=None, preset_conc=None, preset_conc_ratio=None, irr_reactions=None, ex_conc=None, ex_mass_bal_cons=None, ex_thermo_cons=None, inc_enz_cons=None, enz_prot_lb=None, dgpm_conf_level=None)[source]

Perform variability analysis to assess the feasible range of derived fluxes, reaction Gibbs energies and enzyme protein costs.

Parameters:
  • kind ({'fva', 'tfva', 'efva', 'etfva', 'tva', 'etva', 'eva', 'teva'}) – Type of variability analysis to perform: - ‘fva’: Flux Variability Analysis. - ‘tfva’: Thermodynamically constrained Flux Variability Analysis. - ‘efva’: Enzyme protein allocation constrained Flux Variability Analysis. - ‘etfva’: Enzyme protein allocation and thermodynamically constrained Flux Variability Analysis. - ‘tva’: Thermodynamic Variability Analysis. - ‘etva’: Enzyme protein allocation constrained Thermodynamic Variability Analysis. - ‘eva’: Enzyme Protein Variability Analysis. - ‘teva’: Thermodynamically constrained Enzyme Protein Variability Analysis.

  • objective (dict) – Objective function used in corresponding ‘fba’, ‘tfba’, ‘efba’, or ‘etfba’ analysis. Mapping of flux IDs to coefficients in the objective expression, e.g., {‘r1’: 2, ‘r2’: -1} defines the expression “2*r1 - 1*r2”. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • obj_value (non-negative float) – Optimal objective of corresponding ‘fba’, ‘tfba’, ‘efba’, or ‘etfba’ analysis.

  • gamma (float in [0, 1]) – Objective expression required to be no less than gamma*obj_value. Consider adjusting gamma if etfba encounters difficulties in finding feasible solutions.

  • flux_bound (2-tuple) – Lower and upper bound of metabolic fluxes in mmol/gCDW/h. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • conc_bound (2-tuple) – Lower and upper bound of metabolite concentrations in mM. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’, and ‘teva’.

  • spec_flux_bound (dict) – Mapping of flux IDs to their bounds (lb, ub), where spec_flux_bound takes priority over flux_bound. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • spec_conc_bound (dict) – Mapping of metabolite IDs to their bounds (lb, ub), where spec_conc_bound takes priority over conc_bound. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’ and ‘teva’.

  • preset_flux (dict) – Mapping of flux IDs to fixed metabolic fluxes, e.g., substrate update rates. preset_flux takes priority over flux_bound. Suffix of ‘_f’ or ‘_b’ is required to indicate forward or backward flux for reversible reactions. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • preset_conc (dict) – Mapping of metabolite IDs to fixed metabolite concentrations, e.g., substrate concentrations in the media. preset_conc takes priority over conc_bound. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’, and ‘teva’.

  • preset_conc_ratio (dict) – Mapping of ratio IDs to fixed ratios of metabolites. Ratio ID has the format “metabid:metabid”. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’ and ‘teva’.

  • irr_reactions (list of reaction ID) – List of irreversible reaction IDs. irr_reactions is prioritized in defining reversibilities. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • ex_conc (list of metabolite ID) – List of metabolite IDs excluded from optimization. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’ and ‘teva’.

  • ex_mass_bal_cons (list of metabolite ID) – List of metabolite IDs excluded from mass balance constraints. Valid in ‘fva’, ‘tfva’, ‘efva’, ‘etfva’, ‘tva’, ‘etva’, ‘eva’, ‘teva’.

  • ex_thermo_cons (list of reaction ID) – List of reaction IDs excluded from thermodynamics constraints. For reversible reactions, both forward and backward reactions are excluded. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’ and ‘teva’.

  • inc_enz_cons (list of reaction ID) – List of reaction IDs included in enzyme protein cost constraints. Default values are used for missing kinetic parameters of Km, kcat, and MW. Valid in ‘etva’, ‘teva’, ‘efva’ and ‘etfva’.

  • enz_prot_lb (float) – Upper bound of enzyme protein fraction in g/gCDW. Valid in ‘etva’, ‘teva’, ‘efva’ and ‘etfva’.

  • dgpm_conf_level (float) – If dgpm_conf_level is set, the standard reaction Gibbs energy is allowed to vary between [dgpm - z*error, dgpm + z*error], where dgpm and error are the standard reaction Gibbs energy and its error, and z is determined by dgpm_conf_level. Valid in ‘tfva’, ‘etfva’, ‘tva’, ‘etva’ and ‘teva’.

__repr__()[source]

Return repr(self).