7.1.1. cobrame.core package

7.1.1.1. Submodules

7.1.1.2. cobrame.core.reaction module

class cobrame.core.reaction.ComplexFormation(id)[source]

Bases: cobrame.core.reaction.MEReaction

Formation of a functioning enzyme complex that can act as a catalyst for a ME-model reaction.

This reaction class produces a reaction that combines the protein subunits and adds any coenyzmes, prosthetic groups or enzyme modifications to form complete enzyme complex.

Parameters:id (str) – Identifier of the complex formation reaction. As a best practice, this ID should be prefixed with ‘formation + _ + <complex_id>’. If there are multiple ways of producing complex, this can be suffixed with ‘_ + alt’
_complex_id

str – Name of the complex being produced by the complex formation reaction

complex_data_id

str – Name of ComplexData that defines the subunit stoichiometry or subreactions (modfications). This will not always be the same as the _complex_id. Sometimes complexes can be modified using different processes/enzymes

complex

Get the metabolite product of the complex formation reaction

Returns:Instance of complex metabolite from self._complex_id
Return type:cobrame.core.component.Complex
update(verbose=True)[source]

Creates reaction using the associated complex data and adds chemical formula to complex metabolite product.

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.ComplexData):

  1. Complex product defined in self._complex_id
  2. Protein subunits with stoichiometery defined in data.stoichiometry
  3. Metabolites and enzymes w/ coupling coefficients defined in data.subreactions. This often includes enzyme complex modifications by coenzymes or prosthetic groups.
  4. Biomass cobrame.core.component.Constraint corresponding to modifications detailed in data.subreactions, if any
Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()
class cobrame.core.reaction.GenericFormationReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Some components in an ME-model can perform exactly the same function. To handle this, GenericFormationReactions are used to create generic forms of these components.

Parameters:id (str) – Identifier of the generic formation reaction. As a best practice, this ID should be prefixed with ‘metabolite_id + _to_ + generic_metabolite_id’
class cobrame.core.reaction.MEReaction(id=None, name='')[source]

Bases: cobra.core.Reaction.Reaction

MEReaction is a general reaction class from which all ME-Model reactions will inherit

This class contains functionality that can be used by all ME-model reactions

Parameters:id (str) – Identifier of the MEReaction. Should follow best practices of child class
add_biomass_from_subreactions(process_data, biomass=0.0)[source]

Account for the biomass of metabolites added to macromolecule (protein, complex, etc.) due to a modification such as prosthetic group addition.

Parameters:
Returns:

Initial biomass value + biomass added from subreactions in kDa

Return type:

float

add_subreactions(process_data_id, stoichiometry, scale=1.0)[source]

Function to add subreaction process data to reaction stoichiometry

Parameters:
  • process_data_id (str) –

    ID of the process data associated with the metabolic reaction.

    For example, if the modifications are being added to a complex formation reaction, the process data id would be the name of the complex.

  • stoichiometry (dict) – Dictionary of {metabolite_id: float} or {metabolite_id: float * (sympy.Symbol)}
  • scale (float) – Some processes (ie. tRNA charging) are reformulated such that other involved metabolites need scaling
Returns:

Stoichiometry dictionary with updated entries

Return type:

dict

check_me_mass_balance()[source]

Checks the mass balance of ME reaction, ignoring charge balances

Returns:{element: number_of_elemental_imbalances}
Return type:dict
clear_metabolites()[source]

Remove all metabolites from the reaction

get_components_from_ids(id_stoichiometry, default_type=<class 'cobrame.core.component.Metabolite'>, verbose=True)[source]

Function to convert stoichiometry dictionary entries from strings to cobra objects.

{metabolite_id: value} to {cobrame.core.component.Metabolite: value}

Parameters:
  • id_stoichiometry (Dict {string: float}) – Input Dict of {metabolite_id: value}
  • default_type (String) – The type of cobra.Metabolite to default to if the metabolite is not yet present in the model
  • verbose (Boolean) – If True, print metabolites added to model if not yet present in model
Returns:

{cobrame.core.component.Metabolite: float}

Return type:

dict

objective_coefficient

Get and set objective coefficient of reaction

Overrides method in parent class in order to enable use of optlang interfaces.

Returns:Objective coefficient of reaction
Return type:float
class cobrame.core.reaction.MetabolicReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Irreversible metabolic reaction including required enzymatic complex

This reaction class’s update function processes the information contained in the complex data for the enzyme that catalyzes this reaction as well as the stoichiometric data which contains the stoichiometry of the metabolic conversion being performed (i.e. the stoichiometry of the M-model reaction analog)

Parameters:id (str) – Identifier of the metabolic reaction. As a best practice, this ID should use the following template (FWD=forward, REV=reverse): “<StoichiometricData.id> + _ + <FWD or REV> + _ + <Complex.id>”
keff

float – The turnover rete (keff) couples enzymatic dilution to metabolic flux

reverse

boolean – If True, the reaction corresponds to the reverse direction of the reaction. This is necessary since all reversible enzymatic reactions in an ME-model are broken into two irreversible reactions

complex_data

Get or set the ComplexData instance that details the enzyme that catalyzes the metabolic reaction. Can be set with instance of ComplexData or with its id.

Returns:Complex data detailing enzyme that catalyzes this reaction
Return type:cobrame.core.processdata.ComplexData
stoichiometric_data

Get or set the StoichiometricData instance that details the metabolic conversion of the metabolic reaction. Can be set with instance of StoichiometricData or with its id.

Returns:Stoichiometric data detailing enzyme that catalyzes this reaction
Return type::class:`cobrame.core.processdata.StoichiometricData `
update(verbose=True)[source]

Creates reaction using the associated stoichiometric data and complex data.

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.StoichiometricData):

  1. Complex w/ coupling coefficients defined in self.complex_data.id and self.keff
  2. Metabolite stoichiometry defined in data.stoichiometry. Sign is flipped if self.reverse == True

Also sets the lower and upper bounds based on self.reverse and data.upper_bound and data.lower_bound.

Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()
class cobrame.core.reaction.PostTranslationReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Reaction class that includes all posttranslational modification reactions (translocation, protein folding, modification (for lipoproteins) etc)

There are often multiple different reactions/enzymes that can accomplish the same modification/function. In order to account for these and maintain one translation reaction per protein, these processes need to be modeled as separate reactions.

Parameters:id (str) – Identifier of the post translation reaction
add_translocation_pathways(process_data_id, protein_id, stoichiometry=None)[source]

Add complexes and metabolites required to translocate the protein into cell membranes.

Parameters:
  • process_data_id (str) – ID of translocation data defining post translation reaction
  • protein_id (str) – ID of protein being translocated via post translation reaction
  • stoichiometry (dict) – Dictionary of {metabolite_id: float} or {metabolite_id: float * (sympy.Symbol)}
Returns:

Stoichiometry dictionary with updated entries from translocation

Return type:

dict

posttranslation_data

Get or set PostTranslationData that defines the type of post translation modification/process (folding/translocation) that the reaction accounts for. Can be set with instance of PostTranslationData or with its id.

Returns:The PostTranslationData that defines the PostTranslationReaction
Return type:cobrame.core.processdata.PostTranslationData
update(verbose=True)[source]

Creates reaction using the associated posttranslation data and adds chemical formula to processed protein product

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.PostTranslationData):

  1. Processed protein product defined in data.processed_protein_id
  2. Unprocessed protein reactant defined in data.unprocessed_protein_id
  3. Metabolites and enzymes defined in data.subreactions
  4. Translocation pathways defined in data.translocation
  5. Folding mechanism defined in data.folding_mechanims w/ coupling coefficients defined in data.keq_folding, data.k_folding, model.global_info[‘temperature’], data.aggregation_propensity, and data.propensity_scaling
  6. Surface area constraints defined in data.surface_are
  7. Biomass if a significant chemical modification takes place (i.e. lipid modifications for lipoproteins)
Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()
class cobrame.core.reaction.SummaryVariable(id=None)[source]

Bases: cobrame.core.reaction.MEReaction

SummaryVariables are reactions that impose global constraints on the model.

The primary example of this is the biomass_dilution SummaryVariable which forces the rate of biomass production of macromolecules, etc. to be equal to the rate of their dilution to daughter cells during growth.

Parameters:id (str) – Identifier of the SummaryVariable
class cobrame.core.reaction.TranscriptionReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Transcription of a TU to produced TranscribedGene.

RNA is transcribed on a transcription unit (TU) level. This type of reaction produces all of the RNAs contained within a TU, as well as accounts for the splicing/excision of RNA between tRNAs and rRNAs. The appropriate RNA_biomass constrain is produced based on the molecular weight of the RNAs being transcribed

Parameters:id (str) – Identifier of the transcription reaction. As a best practice, this ID should be prefixed with ‘transcription + _’
transcription_data

Get or set the cobrame.core.processdata.TranscriptionData that defines the transcription unit architecture and the features of the RNAs being transcribed.

update(verbose=True)[source]

Creates reaction using the associated transcription data and adds chemical formula to RNA products

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.TranscriptionData):

  1. RNA_polymerase from data.RNA_polymerase w/ coupling coefficient (if present)
  2. RNA products defined in data.RNA_products
  3. Nucleotide reactants defined in data.nucleotide_counts
  4. If tRNA or rRNA contained in data.RNA_types, excised base products
  5. Metabolites + enzymes w/ coupling coefficients defined in data.subreactions (if present)
  6. Biomass cobrame.core.component.Constraint corresponding to data.RNA_products and their associated masses
  7. Demand reactions for each transcript product of this reaction
Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()
class cobrame.core.reaction.TranslationReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Reaction class for the translation of a TranscribedGene to a TranslatedGene

Parameters:id (str) – Identifier of the translation reaction. As a best practice, this ID should be prefixed with ‘translation + _’
translation_data

Get and set the cobra.core.processdata.TranslationData that defines the translation of the gene. Can be set with instance of TranslationData or with its id.

Returns:
Return type:cobra.core.processdata.TranslationData
update(verbose=True)[source]

Creates reaction using the associated translation data and adds chemical formula to protein product

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.TranslationData):

  1. Amino acids defined in data.amino_acid_sequence. Subtracting water to account for condensation reactions during polymerization
  2. Ribosome w/ translation coupling coefficient (if present)
  3. mRNA defined in data.mRNA w/ translation coupling coefficient
  4. mRNA + nucleotides + hydrolysis ATP cost w/ degradation coupling coefficient (if kdeg (defined in model.global_info) > 0)
  5. RNA_degradosome w/ degradation coupling coefficient (if present and kdeg > 0)
  6. Protein product defined in data.protein
  7. Subreactions defined in data.subreactions
  8. protein_biomass cobrame.core.component.Constraint corresponding to the protein product’s mass
  9. Subtract mRNA_biomass cobrame.core.component.Constraint defined by mRNA degradation coupling coefficinet (if kdeg > 0)
Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()
class cobrame.core.reaction.tRNAChargingReaction(id)[source]

Bases: cobrame.core.reaction.MEReaction

Reaction class for the charging of a tRNA with an amino acid

Parameters:id (str) – Identifier for the charging reaction. As a best practice, ID should follow the template “charging_tRNA + _ + <tRNA_locus> + _ + <codon>”. If tRNA initiates translation, <codon> should be replaced with START.
tRNA_data

Get and set the cobra.core.processdata.tRNAData that defines the translation of the gene. Can be set with instance of tRNAData or with its id.

Returns:
Return type:cobra.core.processdata.tRNAData
update(verbose=True)[source]

Creates reaction using the associated tRNA data

This function adds the following components to the reaction stoichiometry (using ‘data’ as shorthand for cobrame.core.processdata.tRNAData):

  1. Charged tRNA product following template: “generic_tRNA + _ + <data.codon> + _ + <data.amino_acid>”
  2. tRNA metabolite (defined in data.RNA) w/ charging coupling coefficient
  3. Charged amino acid (defined in data.amino_acid) w/ charging coupling coefficient
  1. Synthetase (defined in data.synthetase) w/ synthetase coupling coefficient found, in part, using data.synthetase_keff
  2. Post transcriptional modifications defined in data.subreactions
Parameters:verbose (bool) – Prints when new metabolites are added to the model when executing update()

7.1.1.3. cobrame.core.processdata module

class cobrame.core.processdata.ComplexData(id, model)[source]

Bases: cobrame.core.processdata.ProcessData

Contains all information associated with the formation of an functional enzyme complex.

This can include any enzyme complex modifications required for the enzyme to become active.

Parameters:
  • id (str) – Identifier of the complex data. As a best practice, this should typically use the same ID as the complex being formed. In cases with multiple ways to form complex ‘_ + alt’ or similar suffixes can be used.
  • model (cobrame.core.model.MEModel) – ME-model that the ComplexData is associated with
stoichiometry

collections.DefaultDict(int) – Dictionary containing {protein_id: count} for all protein subunits comprising enzyme complex

subreactions

dict – Dictionary of {subreaction_data_id: count} for all complex formation subreactions/modifications. This can include cofactor/prosthetic group binding or enzyme side group addition.

complex

Get complex metabolite object

Returns:Instance of complex metabolite that ComplexData is used to synthesize
Return type:cobrame.core.component.Complex
complex_id

Get and set complex ID for product of complex formation reaction

There are cases where multiple equivalent processes can result in the same final complex. This allows the equivalent final complex complex_id to be queried. This only needs set in the above case

Returns:ID of complex that ComplexData is used to synthesize
Return type:str
create_complex_formation(verbose=True)[source]

creates a complex formation reaction

This assumes none exists already. Will create a reaction (prefixed by “formation”) which forms the complex

Parameters:verbose (bool) – If True, print if a metabolite is added to model during update
formation

Get the formation reaction object

Returns:Complex formation reaction detailed in ComplexData
Return type:cobrame.core.reaction.ComplexFormation
class cobrame.core.processdata.GenericData(id, model, component_list)[source]

Bases: cobrame.core.processdata.ProcessData

Class for storing information about generic metabolites

Parameters:
  • id (str) – Identifier of the generic metabolite. As a best practice, this ID should be prefixed with ‘generic + _’
  • model (cobrame.core.model.MEModel) – ME-model that the GenericData is associated with
  • component_list (list) – List of metabolite ids for all metabolites that can provide identical functionality
create_reactions()[source]

Adds reaction with id “<metabolite_id> + _ + to + _ + <generic_id>” for each metabolite in self.component_list.

Creates generic metabolite and generic reaction, if they do not already exist.

class cobrame.core.processdata.PostTranslationData(id, model, processed_protein, preprocessed_protein)[source]

Bases: cobrame.core.processdata.ProcessData

Parameters:
  • id (str) – Identifier for post translation process.
  • model (cobrame.core.model.MEModel) – ME-model that the PostTranslationData is associated with
  • processed_protein (str) – ID of protein following post translational process
  • preprocessed_protein (str) – ID of protein before post translational process
translocation

set – Translocation pathways involved in post translation reaction.

Set of {cobrame.core.processdata.TranslocationData.id}

translocation_multipliers

dict – Some proteins require different coupling of translocation enzymes.

Dictionary of {cobrame.core.processdata.TranslocationData.id: float}

surface_area

dict – If protein is translated into the inner or outer membrane, the surface area the protein occupies can be accounted for as well.

Dictionary of {SA_+<inner_membrane or outer_membrane>: float}

subreactions

collections.DefaultDict(float) – If a protein is modified following translation, this is accounted for here

Dictionary of {subreaction_id: float}

biomass_type

str – If the subreactions add biomass to the translated gene, the biomass type (cobrame.core.compontent.Constraint.id) of the modification must be defined.

folding_mechanism

str – ID of folding mechanism for post translation reaction

aggregation_propensity

float – Aggregation propensity for the protein

keq_folding

dict – Temperature dependant keq for folding protein

Dictionary of {str(temperature): value}

k_folding

dict – Temperature dependant rate constant (k) for folding protein

Dictionary of {str(temperature): value}

propensity_scaling

float – Some small peptides are more likely to be folded by certain chaperones. This is accounted for using propensity_scaling.

class cobrame.core.processdata.ProcessData(id, model)[source]

Bases: object

Generic class for storing information about a process

This class essentially acts as a database that contains all of the relevant information needed to construct a particular reaction. For example, to construct a transcription reaction, following information must be accessed in some way:

  • nucleotide sequence of the transcription unit
  • RNA_polymerase (w/ sigma factor)
  • RNAs transcribed from transcription unit
  • other processes involved in transcription of RNAs (splicing, etc.)

ME-model reactions are built from information in these objects.

Parameters:
model

Get the ME-model the process data is associated with

Returns:ME-model that uses this process data
Return type:class:`cobrame.core.model.MEModel
parent_reactions

Get reactions that the ProcessData instance is used to construct.

Returns:Parent reactions of ProcessData
Return type:set
update_parent_reactions()[source]

Executes the update() function for all reactions that the ProcessData instance is used to construct.

class cobrame.core.processdata.StoichiometricData(id, model)[source]

Bases: cobrame.core.processdata.ProcessData

Encodes the stoichiometry for a metabolic reaction.

StoichiometricData defines the metabolite stoichiometry and upper/lower bounds of metabolic reaction

Parameters:
  • id (str) – Identifier of the metabolic reaction. Should be identical to the M-model reactions in most cases.
  • model (cobrame.core.model.MEModel) – ME-model that the StoichiometricData is associated with
_stoichiometry

dict – Dictionary of {metabolite_id: stoichiometry} for reaction

subreactions

collections.DefaultDict(int) – Cases where multiple enzymes (often carriers ie. Acyl Carrier Protein) are involved in a metabolic reactions.

upper_bound

int – Upper reaction bound of metabolic reaction. Should be identical to the M-model reactions in most cases.

lower_bound

int – Lower reaction bound of metabolic reaction. Should be identical to the M-model reactions in most cases.

stoichiometry

Get or set metabolite stoichiometry for reaction.

Returns:Dictionary of {metabolite_id: stoichiometry}
Return type:dict
class cobrame.core.processdata.SubreactionData(id, model)[source]

Bases: cobrame.core.processdata.ProcessData

Parameters:
  • id (str) – Identifier of the subreaction data. As a best practice, if the subreaction data details a modification, the ID should be prefixed with “mod + _”
  • model (cobrame.core.model.MEModel) – ME-model that the SubreactionData is associated with
enzyme

list or str or None – List of cobrame.core.component.Complex.id s for enzymes that catalyze this process

or

String of single cobrame.core.component.Complex.id for enzyme that catalyzes this process

keff

float – Effective turnover rate of enzyme(s) in subreaction process

_element_contribution

dict – If subreaction adds a chemical moiety to a macromolecules via a modification or other means, net element contribution of the modification process should be accounted for. This can be used to mass balance check each of the individual processes.

Dictionary of {element: net_number_of_contributions}

calculate_biomass_contribution()[source]

Calculate net biomass increase/decrease as a result of the subreaction process.

If subreaction adds a chemical moiety to a macromolecules via a modification or other means, the biomass contribution of the modification process should be accounted for and ultimately included in the reaction it is involved in.

Returns:Mass of moiety transferred to macromolecule by subreaction
Return type:float
calculate_element_contribution()[source]

Calculate net contribution of chemical elements based on the stoichiometry of the subreaction data

Returns:Dictionary of {element: net_number_of_contributions}
Return type:dict
element_contribution

Get net contribution of elements from subreaction process to macromolecule

If subreaction adds a chemical moiety to a macromolecules via a modification or other means, net element contribution of the modification process should be accounted for. This can be used to mass balance check each of the individual processes.

Returns:Dictionary of {element: net_number_of_contributions}
Return type:dict
get_all_usages()[source]

Get all process data that the subreaction is involved in

Yields:cobrame.core.processdata.ProcessData – ProcessData that subreaction is involved in
get_complex_data()[source]

Get the complex data that the subreaction is involved in

Yields:cobrame.core.processdata.ComplexData – ComplexData that subreaction is involved in
class cobrame.core.processdata.TranscriptionData(id, model, rna_products=set([]))[source]

Bases: cobrame.core.processdata.ProcessData

Class for storing information needed to define a transcription reaction

Parameters:
  • id (str) – Identifier of the transcription unit, typically beginning with ‘TU’
  • model (cobrame.core.model.MEModel) – ME-model that the TranscriptionData is associated with
nucleotide_sequence

str – String of base pair abbreviations for nucleotides contained in the transcription unit

RNA_products

set – IDs of cobrame.core.component.TranscribedGene that the transcription unit encodes. Each member should be prefixed with “RNA + _”

RNA_polymerase

str – ID of the cobrame.core.component.RNAP that transcribes the transcription unit. Different IDs are used for different sigma factors

subreactions

collections.DefaultDict(int) – Dictionary of {cobrame.core.processdata.SubreactionData ID: num_usages} required for the transcription unit to be transcribed

RNA_types

Get generator consisting of the RNA type for each RNA product

Yields:str – (mRNA, tRNA, rRNA, ncRNA)
codes_stable_rna

Get whether transcription unit codes for a stable RNA

Returns:True if tRNA or rRNA in RNA products False if not
Return type:bool
excised_bases

Get count of bases that are excised during transcription

If a stable RNA (e.g. tRNA or rRNA) is coded for in the transcription unit, the transcript must be spliced in order for these to function.

This determines whether the transcription unit requires splicing and, if so, returns the count of nucleotides within the transcription unit that are not accounted for in the RNA products, thus identifying the appropriate introns nucleotides.

Returns:{nucleotide_monophosphate_id: number_excised}

i.e. {“amp_c”: 10, “gmp_c”: 11, “ump_c”: 9, “cmp_c”: 11}

Return type:dict
nucleotide_count

Get count of each nucleotide contained in the nucleotide sequence

Returns:{nuclotide_id: number_of_occurances}
Return type:dict
class cobrame.core.processdata.TranslationData(id, model, mrna, protein)[source]

Bases: cobrame.core.processdata.ProcessData

Class for storing information about a translation reaction.

Parameters:
  • id (str) – Identifier of the gene being translated, typically the locus tag
  • model (cobrame.core.model.MEModel) – ME-model that the TranslationData is associated with
  • mrna (str) – ID of the mRNA that is being translated
  • protein (str) – ID of the protein product.
mRNA

str – ID of the mRNA that is being translated

protein

str – ID of the protein product.

subreactions

collections.DefaultDict(int) – Dictionary of {cobrame.core.processdata.SubreactionData.id: num_usages} required for the mRNA to be translated

nucleotide_sequence

str – String of base pair abbreviations for nucleotides contained in the gene being translated

add_elongation_subreactions(elongation_subreactions=set([]))[source]

Add all subreactions involved in translation elongation.

This includes:

  • tRNA activity subreactions returned with subreactions_from_sequence() which is called within this function.
  • Elongation subreactions passed into this function. These will be added with a value of len(amino_acid_sequence) - 1 as these are involved in each amino acid addition

Some additional enzymatic processes are required for each amino acid addition during translation elongation

Parameters:elongation_subreactions (set) – Subreactions that are required for each amino acid addition
add_initiation_subreactions(start_codons=set([]), start_subreactions=set([]))[source]

Add all subreactions involved in translation initiation.

Parameters:
  • start_codons (set, optional) – Start codon sequences for the organism being modeled
  • start_subreactions (set, optional) – Subreactions required to initiate translation, including the activity by the start tRNA
add_termination_subreactions(translation_terminator_dict=None)[source]

Add all subreactions involved in translation termination.

Parameters:translation_terminator_dict (dict or None) – {stop_codon : enzyme_id_of_terminator_enzyme}
amino_acid_count

Get number of each amino acid in the translated protein

Returns:{amino_acid_id: number_of_occurrences}
Return type:dict
amino_acid_sequence

Get amino acid sequence from mRNA’s nucleotide sequence

Returns:Amino acid sequence
Return type:str
codon_count

Get the number of each codon contained within the gene sequence

Returns:{codon_sequence: number_of_occurrences}
Return type:dict
first_codon

Get the first codon contained in the mRNA sequence. This should correspond to the start codon for the gene.

Returns:First 3 nucleotides comprising the first codon in the mRNA gene sequence
Return type:str
last_codon

Get the last codon contained in the mRNA sequence. This should correspond to the stop codon for the gene.

Returns:Last 3 nucleotides comprising the last codon in the mRNA gene sequence
Return type:str
subreactions_from_sequence

Get subreactions associated with each tRNA/AA addition.

tRNA activity is accounted for as subreactions. This returns the subreaction counts associated with each amino acid addition, based on the sequence of the mRNA.

Returns:{cobrame.core.processdata.SubreactionData.id: num_usages}
Return type:dict
class cobrame.core.processdata.TranslocationData(id, model)[source]

Bases: cobrame.core.processdata.ProcessData

Class for storing information about a protein translocation pathway

Parameters:
  • id (str) – Identifier for translocation pathway.
  • model (cobrame.core.model.MEModel) – ME-model that the TranslocationData is associated with
keff

float – Effective turnover rate of the enzymes in the translocation pathway

enzyme_dict

dict – Dictionary containing enzyme specific information about the way it is coupled to protein translocation

{enzyme_id: {length_dependent: <True or False>,
fixed_keff: <True or False>}}
length_dependent_energy

bool – True if the ATP cost of translocation is dependent on the length of the protein

stoichiometry

dict – Stoichiometry of translocation pathway, typically ATP/GTP hydrolysis

class cobrame.core.processdata.tRNAData(id, model, amino_acid, rna, codon)[source]

Bases: cobrame.core.processdata.ProcessData

Class for storing information about a tRNA charging reaction.

Parameters:
  • id (str) – Identifier for tRNA charging process. As best practice, this should be follow “tRNA + _ + <tRNA_locus> + _ + <codon>” template. If tRNA initiates translation, <codon> should be replaced with START.
  • model (cobrame.core.model.MEModel) – ME-model that the tRNAData is associated with
  • amino_acid (str) – Amino acid that the tRNA transfers to an peptide
  • rna (str) – ID of the uncharged tRNA metabolite. As a best practice, this ID should be prefixed with ‘RNA + _’
subreactions

collections.DefaultDict(int) – Dictionary of {cobrame.core.processdata.SubreactionData.id: num_usages} required for the tRNA to be charged

synthetase

str – ID of the tRNA synthetase required to charge the tRNA with an amino acid

synthetase_keff

float – Effective turnover rate of the tRNA synthetase

7.1.1.4. cobrame.core.component module

class cobrame.core.component.Complex(id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for protein complexes

Parameters:id (str) – Identifier of the protein complex.
metabolic_reactions

Get metabolic reactions catalyzed by complex

Returns:List of cobrame.core.reaction.MetabolicReaction s catalyzed by complex.
Return type:list
class cobrame.core.component.Constraint(id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for global constraints such as biomass

Parameters:id (str) – Identifier of the constraint
class cobrame.core.component.GenericComponent(id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for generic components created from cobrame.core.reaction.GenericFormationReaction

Parameters:id (str) – Identifier of the generic tRNA. As a best practice should follow template: ‘generic + _ + <generic metabolite id>’
class cobrame.core.component.GenerictRNA(id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for generic tRNAs created from cobrame.core.reaction.tRNAChargingReaction

Parameters:id (str) – Identifier of the generic tRNA. As a best practice should follow template: ‘generic_tRNA + _ + <codon> + _ + <amino acid metabolite id>’
class cobrame.core.component.MEComponent(id)[source]

Bases: cobra.core.Metabolite.Metabolite

COBRAme component representation. Inherits from cobra.core.metabolite.Metabolite

Parameters:id (str) – Identifier of the component. Should follow best practices of child classes
remove_from_me_model(method='subtractive')[source]

Remove metabolite from me model along with any relevant cobrame.core.processdata.ProcessData

Parameters:method (str) –
  • destructive: remove metabolite from model and remove reactions it is involved in
  • subtractive: remove only metabolite from model
class cobrame.core.component.Metabolite(id)[source]

Bases: cobrame.core.component.MEComponent

COBRAme metabolite representation

Parameters:id (str) – Identifier of the metabolite
class cobrame.core.component.ProcessedProtein(id, unprocessed_protein_id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for protein created from cobrame.core.reaction.PostTranslationReaction

Parameters:
  • id (str) – Identifier of the processed protein
  • unprocessed_protein_id (str) – Identifier of protein before being processed by PostTranslationReaction
unprocessed_protein

Get unprocessed protein reactant in PostTranslationReaction

Returns:Unprocessed protein object
Return type:cobrame.core.component.TranslatedGene
class cobrame.core.component.RNAP(id)[source]

Bases: cobrame.core.component.Complex

Metabolite class for RNA polymerase complexes. Inherits from cobrame.core.component.Complex

Parameters:id (str) – Identifier of the RNA Polymerase.
class cobrame.core.component.Ribosome(id)[source]

Bases: cobrame.core.component.Complex

Metabolite class for Ribosome complexes. Inherits from cobrame.core.component.Complex

Parameters:id (str) – Identifier of the Ribosome.
class cobrame.core.component.TranscribedGene(id, rna_type, nucleotide_sequence)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for gene created from cobrame.core.reaction.TranscriptionReaction

Parameters:
  • id (str) – Identifier of the transcribed gene. As a best practice, this ID should be prefixed with ‘RNA + _’
  • RNA_type (str) – Type of RNA encoded by gene sequence (mRNA, rRNA, tRNA, or ncRNA)
  • nucleotide_sequence (str) – String of base pair abbreviations for nucleotides contained in the gene
left_pos

int – Left position of gene on the sequence of the (+) strain

right_pos

int – Right position of gene on the sequence of the (+) strain

strand

str

  • (+) if the RNA product is on the leading strand
  • (-) if the RNA product is on the comple(mentary strand
nucleotide_count

Get number of each nucleotide monophosphate

Returns:{nucleotide_monophosphate_id: count}
Return type:dict
class cobrame.core.component.TranslatedGene(id)[source]

Bases: cobrame.core.component.MEComponent

Metabolite class for protein created from cobrame.core.reaction.TranslationReaction

Parameters:id (str) – Identifier of the translated protein product. Should be prefixed with “protein + _”
amino_acid_sequence

Get amino acid sequence of protein

Returns:Amino acid sequence of protein
Return type:str
complexes

Get the complexes that the protein forms

Returns:List of cobrame.core.component.Complex s that the protein is a subunit of
Return type:list
metabolic_reactions

Get the mtabolic reactions that the protein helps catalyze

Returns:List of cobrame.core.reactions.MetabolicReaction s that the protein helps catalyze
Return type:list
translation_data

Get translation data that defines protein.

Assumes that TranslatedGene is “protein + _ + <translation data id>”

Returns:Translation data used to form translation reaction of protein
Return type:cobrame.core.processdata.TranslationData
cobrame.core.component.create_component(component_id, default_type=<class 'cobrame.core.component.MEComponent'>, rnap_set=set([]))[source]

creates a component and attempts to set the correct type

7.1.1.5. cobra.core.model module

class cobrame.core.model.MEModel(*args)[source]

Bases: cobra.core.Model.Model

add_biomass_constraints_to_model(biomass_types)[source]
complex_data
compute_solution_error(solution=None)[source]
construct_attribute_vector(attr_name, growth_rate)[source]

build a vector of a reaction attribute at a specific growth rate

Mainly used for upper and lower bounds

construct_s_matrix(growth_rate)[source]

build the stoichiometric matrix at a specific growth rate

gam
generic_data
get_metabolic_flux(solution=None)[source]

extract the flux state for metabolic reactions

get_transcription_flux(solution=None)[source]

extract the transcription flux state

get_translation_flux(solution=None)[source]

extract the translation flux state

ngam
posttranslation_data
prune(skip=None)[source]

remove all unused metabolites and reactions

This should be run after the model is fully built. It will be difficult to add new content to the model once this has been run.

skip: list
List of complexes/proteins/mRNAs/TUs to remain unpruned from model.
remove_genes_from_model(gene_list)[source]
set_sasa_keffs(median_keff)[source]
stoichiometric_data
subreaction_data
tRNA_data
transcription_data
translation_data
translocation_data
unmodeled_protein
unmodeled_protein_biomass
unmodeled_protein_fraction
update()[source]

updates all component reactions

7.1.1.6. Module contents