3.1.1.2. etfl.core

3.1.1.2.1. Submodules

3.1.1.2.2. Package Contents

3.1.1.2.2.1. Classes

Enzyme

Helper class that provides a standard way to create an ABC using

Ribosome

Helper class that provides a standard way to create an ABC using

RNAPolymerase

Helper class that provides a standard way to create an ABC using

ThermoMEModel

MEModel

class etfl.core.Enzyme(id=None, kcat=None, kcat_fwd=None, kcat_bwd=None, kdeg=None, composition=None, *args, **kwargs)[source]

Bases: etfl.core.macromolecule.Macromolecule

Helper class that provides a standard way to create an ABC using inheritance.

init_variable(self, queue=False)

Attach an EnzymeVariable object to the Species. Needs to have the object attached to a model

Returns

property molecular_weight(self)

Necessary for scaling Use Biopython for this

Returns

class etfl.core.Ribosome(id=None, kribo=None, kdeg=None, composition=None, rrna=None, *args, **kwargs)[source]

Bases: Enzyme

Helper class that provides a standard way to create an ABC using inheritance.

property kribo(self)
property molecular_weight(self)

Necessary for scaling Use Biopython for this

Returns

class etfl.core.RNAPolymerase(id=None, ktrans=None, kdeg=None, composition=None, *args, **kwargs)[source]

Bases: Enzyme

Helper class that provides a standard way to create an ABC using inheritance.

property ktrans(self)
class etfl.core.ThermoMEModel(thermo_data, model=Model(), name=None, growth_reaction='', mu=None, mu_error=0, mu_range=None, n_mu_bins=1, big_M=1000, temperature=std.TEMPERATURE_0, min_ph=std.MIN_PH, max_ph=std.MAX_PH, prot_scaling=1000, mrna_scaling=None)[source]

Bases: etfl.core.memodel.MEModel, pytfa.thermo.ThermoModel

print_info(self)
__deepcopy__(self, memodict={})
copy(self)
class etfl.core.MEModel(model=Model(), name=None, growth_reaction='', mu_range=None, n_mu_bins=1, big_M=1000, *args, **kwargs)[source]

Bases: pytfa.core.model.LCSBModel, cobra.Model

init_etfl(self, big_M, growth_reaction, mu_range, n_mu_bins, name)
property mu(self)
property mu_max(self)
make_mu_bins(self)
property n_mu_bins(self)
init_mu_variables(self)

Necessary for the zeroth order approximation of mu:

\[mu \in [0.1, 0.9] , nbins = 8 => mu = 0.15 OR mu = 0.25 OR ... OR mu = 0.85\]

Using binary expansion of the bins instead of a list of 0-1s described here

Returns

property mu_approx_resolution(self)
property growth_reaction(self)

Returns the growth reaction of the model. Useful because tied to the growth variable

Returns

add_nucleotide_sequences(self, sequences)
Parameters

sequences

Returns

add_transcription_by(self, transcription_dict)
add_translation_by(self, translation_dict)
add_min_tcpt_activity(self, min_act_dict)
add_min_tnsl_activity(self, min_act_dict)
_make_peptide_from_gene(self, gene_id)
add_peptide_sequences(self, aa_sequences)
add_dummies(self, nt_ratios, mrna_kdeg, mrna_length, aa_ratios, enzyme_kdeg, peptide_length, transcribed_by=None, translated_by=None)

Create dummy peptide and mrna to enforce mrna and peptide production. Can be used to account for the missing data for all mrnas and proteins.

Parameters
  • nt_ratios

  • mrna_kdeg

  • mrna_length

  • aa_ratios

  • enzyme_kdeg

  • peptide_length

  • gtp

  • gdp

  • h2o

  • h

Returns

add_essentials(self, essentials, aa_dict, rna_nucleotides, rna_nucleotides_mp)

Marks important metabolites for expression

Parameters
  • essentials

    A dictionary of important metabolites to met id

    Example :

    essentials = {
                'atp': 'atp_c',
                'adp': 'adp_c',
                'amp': 'amp_c',
                ...
                'h2o': 'h2o_c',
                'h': 'h_c'}
            }
    

  • aa_dict

    A dictionary of aminoacid letter to amicoacid met id

    Example :

    aa_dict = {
                'A':'ala__L_c',
                'R':'arg__L_c',
                ...
            }
    

  • rna_nucleotides

    A dictionary of RNA nucleotide triphosphate letter to nucleotideTP met id

    Example :

    rna_nucleotides = {
                'A':'atp_c',
                'U':'utp_c',
                ...
            }
    

  • rna_nucleotides_mp

    A dictionary of RNA nucleotide monophosphate letter to nucleotideMP met id

    Example :

    rna_nucleotides_mp = {
                'A':'amp_c',
                'U':'ump_c',
                ...
            }
    

Returns

build_expression(self)

Given a dictionary from amino acids nucleotides to metabolite names, goes through the list of genes in the model that have sequence information to build transcription and translation reactions

Returns

express_genes(self, gene_list)

Adds translation and transcription reaction to the genes in the provided list

Parameters

gene_list (Iterable of str or ExpressedGene) –

Returns

_add_gene_translation_reaction(self, gene)
Parameters

gene (CodingGene) – A gene of the model that has sequence data

Returns

_add_gene_transcription_reaction(self, gene)

Adds the transcription reaction related to a gene

Parameters

gene (ExpressedGene) – A gene of the model that has sequence data

Returns

add_trna_mass_balances(self)

Once the tRNAs, transcription and translation reactions have been added, we need to add the constraints:

d/dt [charged_tRNA] = v_charging - sum(nu_trans*v_trans) - mu*[charged_tRNA] d/dt [uncharged_tRNA] = -v_charging + sum(nu_trans*v_trans) - mu*[uncharged_tRNA]

The stoichiometries are set from the reaction dict in _extract_trna_from_reaction

We also need to scale the tRNAs in mRNA space and unscale the translation:

d/dt σ_m * [*charged_tRNA] =    +- σ_m * v_charging
                                -+ σ_m/σ_p*sum(nu_tsl*σ_p*v_tr)
                                -  σ_m * mu*[*charged_tRNA]

d/dt [*charged_tRNA]_hat =      +- σ_m * v_charging
                                -+ σ_m/σ_p * sum( nu_tsl * v_tr_hat)
                            -  mu*[*charged_tRNA]_hat
Returns

add_enzymatic_coupling(self, coupling_dict)

Couples the enzymatic reactions maximal rates with the Enzyme availability The coupling dictionary looks like:

coupling_dict : {
                'reaction_id_1':[   enzyme_instance_1,
                                    enzyme_instance_2],
                'reaction_id_2':[   enzyme_instance_3,
                                    enzyme_instance_4,
                                    enzyme_instance_5],
Parameters

coupling_dict ({str:list(Enzyme)}) – A dictionary of reaction ids to enzyme lists

Returns

apply_enzyme_catalytic_constraint(self, reaction)

Apply a catalytic constraint using a gene-enzymes reaction rule (GPR)

Parameters

reaction

Returns

add_mass_balance_constraint(self, synthesis_flux, macromolecule=None, queue=False)

Adds a mass balance constraint of the type

\[d[E]/dt = 0 <=> v_synthesis - k_deg*[M] - μ*[M] = 0\]

for a macromolecule (mRNA or enzyme)

Parameters
  • synthesis_flux

  • macromolecule

Returns

linearize_me(self, macromolecule, queue=False)

Performs Petersen linearization on μ*E to keep a MILP problem

Returns

get_ordered_ga_vars(self)

Returns in order the variables that discretize growth :return:

_prep_enzyme_variables(self, enzyme)

Reads Enzyme.composition to find complexation reaction from enzyme information

Parameters

reaction (cobra.Reaction) –

Returns

make_enzyme_complexation(self, enzyme)

Makes the complexation reaction and attached it to its enzyme

Parameters

enzyme

Returns

add_enzymes(self, enzyme_list, prep=True)

Adds an Enzyme object, or iterable of Enzyme objects, to the model :param enzyme_list: :type enzyme_list:Iterable(Enzyme) or Enzyme :param prep: whether or not to add complexation, degradation, and mass

balance constraints (needs to be overridden for dummies for example)

Returns

add_mrnas(self, mrna_list, add_degradation=True)

Adds a mRNA object, or iterable of mRNA objects, to the model :param mrna_list: :type mrna_list:Iterable(mRNA) or mRNA :return:

add_trnas(self, trna_list)

Adds a tRNA object, or iterable of tRNA objects, to the model :param trna_list: :type trna_list:Iterable(tRNA) or tRNA :return:

add_dna(self, dna)

Adds a DNA object to the model

Parameters

dna (DNA) –

Returns

add_lipid(self, lipid)

Adds a lipid object to the model

Parameters

lipid (Lipid) –

Returns

add_ion(self, ion)

Adds a ion object to the model

Parameters

ion (ion) –

Returns

add_carbohydrate(self, carbohydrate)

Adds a carbohydrate object to the model

Parameters

carbohydrate (carbohydrate) –

Returns

remove_enzymes(self, enzyme_list)

Removes an Enzyme object, or iterable of Enzyme objects, from the model

Parameters

enzyme_list

:type enzyme_list:Iterable(Enzyme) or Enzyme :return:

_add_enzyme_degradation(self, enzyme, scaled=True, queue=False)

Given an enzyme, adds the corresponding degradation reaction

Parameters
  • enzyme (Enzyme) –

  • scaled (bool) – Indicates whether scaling should be performed (see manuscript)

  • queue (bool) – Indicates whether to add the variable directly or in the next batch

Returns

_add_mrna_degradation(self, mrna, scaled=True, queue=False)

Given an mRNA, adds the corresponding degradation reaction

Parameters
  • mrna (mRNA) –

  • scaled (bool) – Indicates whether scaling should be performed (see manuscript)

  • queue (bool) – Indicates whether to add the variable directly or in the next batch

Returns

_make_degradation_reaction(self, deg_stoich, macromolecule, kind, scaled, queue=False)

given a degradation stoichiometry, makes the corresponding degradation reaction

Parameters
  • deg_stoich (dict({cobra.core.Species:Number})) – stoichiometry of the degradation

  • macromolecule (Macromolecule) – the macromalecule being degraded. Used for binding the degradation constraint

  • kind (mRNADegradation or EnzymeDegradation) – kind of constraint

  • scaled (bool) – Indicates whether scaling should be performed (see manuscript)

  • queue (bool) – Indicates whether to add the variable directly or in the next batch

Returns

populate_expression(self)

Defines upper- and lower_bound for the RNAP and Ribosome binding capacities and define catalytic constraints for the RNAP and Ribosome

Returns

add_mrna_mass_balance(self, the_mrna)
_constrain_polysome(self, the_mrna, basal_fraction=0)

Add the coupling between mRNA availability and ribosome charging The number of ribosomes assigned to a mRNA species is lower than the number of such mRNA times the max number of ribosomes that can sit on the mRNA: [RPi] <= loadmax_i*[mRNAi]

loadmax is : len(peptide_chain)/size(ribo) Their distance from one another along the mRNA is at least the size of the physical footprint of a ribosome (≈20 nm, BNID 102320, 100121) which is the length of about 60 base pairs (length of nucleotide ≈0.3 nm, BNID 103777), equivalent to ≈20 aa. also 28715909 “http://book.bionumbers.org/how-many-proteins-are-made-per-mrna-molecule/

Hence: [RPi] <= L_nt/Ribo_footprint * [mRNA]

In addition, it also adds a minimal binding activity for ribosome to the mRNA. We modeled it as a Fraction of the maximum loadmax and the Fraction depends on the affinity of ribosome to the mRNA: [RPi] >= Fraction * L_nt/Ribo_footprint * [mRNA]

Returns

_constrain_polymerase(self, the_gene, basal_fraction=0)

Add the coupling between DNA availability and RNAP charging The number of RNAP assigned to a gene locus is lower than the number of such loci times the max number of RNAP that can sit on the locus: [RNAPi] <= loadmax_i*[# of loci]*[DNA]

loadmax is : len(nucleotide chain)/size(RNAP)

“The footprint of RNAP II […] covers approximately 40 nt and is nearly symmetrical […].” BNID 107873 Range ~40 Nucleotides

Hence: [RNAPi] <= loadmax_i*[# of loci]*[DNA]

In addition, it also adds a minimal binding activity for RNAP to the gene. We modeled it as a Fraction of the maximum loadmax and the Fraction depends on the affinity of RNAP to the gene, i.e. the strength of the promoter: [RNAPi] >= Fraction * L_nt/RNAP_footprint * [# of loci]*[DNA]

Returns

edit_gene_copy_number(self, gene_id)

Edits the RNAP allocation constraints if the copy number of a gene changes.

Parameters

gene_id

Returns

recompute_translation(self)
Returns

recompute_transcription(self)
Returns

recompute_allocation(self)
Returns

_get_transcription_name(self, the_mrna_id)

Given an mrna_id, gives the id of the corresponding transcription reaction :param the_mrna_id: :type the_mrna_id: str :return: str

_get_translation_name(self, the_peptide_id)

Given an mrna_id, gives the id of the corresponding translation reaction :param the_peptide_id: :type the_peptide_id: str :return: str

get_translation(self, the_peptide_id)

Given an peptide_id, gives the translation reaction :param the_peptide_id: :type the_peptide_id: str :return: TranslationReaction

get_transcription(self, the_peptide_id)

Given an mrna_id, gives corresponding transcription reaction :param the_mrna_id: :type the_mrna_id: str :return: TranscriptionReaction

add_rnap(self, rnap, free_ratio=0)

Adds the RNA Polymerase used by the model.

Parameters

rnap (Ribosome) –

Returns

_populate_rnap(self)

Once RNAP have been assigned to the model, we still need to link them to the rest of the variables and constraints. This function creates the mass balance constraint on the RNAP, as well as the total RNAP capacity constraint :return:

_sort_rnap_assignment(self)
_get_rnap_total_capacity(self, rnap_ids, genes)
apply_rnap_catalytic_constraint(self, reaction, queue)

Given a translation reaction, apply the constraint that links it with RNAP usage :param reaction: a TranscriptionReaction :type reaction: TranscriptionReaction :return:

_add_free_enzyme_ratio(self, enzyme, free_ratio)

Adds free enzyme variables to the models /!A total capacity constraint still needs to be added # TODO: Make that more user friendly :return:

add_ribosome(self, ribosome, free_ratio)

Adds the ribosome used by the model.

Parameters

ribosome (Ribosome) –

Returns

add_rrnas_to_rib_assembly(self, ribosome)

Adds the ribosomal RMAs to the composition of the ribosome. This has to be done after the transcription reactions have been added, so that the rRNAs synthesis reactions exist for the mass balance

Returns

property Rt(self)
_populate_ribosomes(self)

Once ribosomes have been assigned to the model, we still need to link them to the rest of the variables and constraints. This function creates the mass balance constraint on the ribosomes, as well as the total ribosome capacity constraint :return:

couple_rrna_synthesis(self)
_sort_rib_assignment(self)
_get_rib_total_capacity(self, rib_ids, genes)
apply_ribosomal_catalytic_constraint(self, reaction)

Given a translation reaction, apply the constraint that links it with ribosome usage :param reaction: a TranslationReaction :type reaction: TranslationReaction :return:

add_genes(self, genes)

Oddly I could not find this method in cobra. Adds one or several genes to the model.

Parameters

genes (Iterable(Gene) or Gene) –

Returns

_add_gene(self, gene)
sanitize_varnames(self)

Makes variable name safe for the solvers. In particular, variables whose name start with :return:

print_info(self, specific=False)

Print information and counts for the cobra_model :return:

__deepcopy__(self, memo)

Calls self.copy() to return an independant copy of the model

Parameters

memo

Returns

copy(self)

Pseudo-smart copy of the model using dict serialization. This builds a new model from the ground up, with independwnt variables, solver, etc.

Returns