VirtualMicrobes.event package

Submodules

VirtualMicrobes.event.Molecule module

class VirtualMicrobes.event.Molecule.Molecule(name, toxic_level=None, is_internal=True, pair=True, is_building_block=False, is_gene_product=False, mol_class=None, is_energy=False, environment=None, **kwargs)[source]

Bases: object

Small molecules of the system. Can exist internally or externally. Some are metabolites that can take place in (enzymatic) reactions. Can diffuse over membranes and may be transported into or out of the cell.
Version:
Author:
class_version = '1.0'
energy_level
environment
index = 0
is_building_block
is_energy
is_gene_product
is_influxed
is_internal
mol_class
pair_up()[source]

Create a paired molecule for self on the other side of the Cell membrane. When updating a property of self, the property of the paired molecule is automatically updated (if appropriate; e.g. toxic_level or is_energy)

set_building_block(val=True)[source]
toxic_level
classmethod unique_index(increase=None)[source]
upgrade()[source]

Upgrading from older pickled version of class to latest version. Version information is saved as class variable and should be updated when class invariants (e.g. fields) are added.

class VirtualMicrobes.event.Molecule.MoleculeClass(name, molecule_species=None, energy_level=1, is_energy=False, has_building_block=False)[source]

Bases: object

add_molecule(molecule)[source]

Add a molecule to this molecule class. We will put the ‘internal’ variants in the class; Internal variants of molecules reference the external molecules. :param molecule:

product_in_reaction(reaction)[source]
reactant_in_reaction(reaction)[source]

Add a reaction that has a molecule of this class as one of its reactants. :param reaction: the reaction

class VirtualMicrobes.event.Molecule.MoleculeIndexer[source]

Bases: object

VirtualMicrobes.event.Reaction module

exception VirtualMicrobes.event.Reaction.BadStoichiometryException[source]

Bases: exceptions.Exception

class VirtualMicrobes.event.Reaction.ClassConvert(substrate, energy, product)[source]

Bases: VirtualMicrobes.event.Reaction.Convert

init_sub_reaction_dicts()[source]

Write out dictionaries for the sub_reactions generated by sub_reactions()

class VirtualMicrobes.event.Reaction.Convert(reactants, products, stoichiometry)[source]

Bases: VirtualMicrobes.event.Reaction.Reaction

init_sub_reaction_dicts()[source]

Write out dictionaries for the sub_reactions generated by sub_reactions()

prod_species
reac_species
sub_reactions()[source]

Returns a list of all potential reaction schemes in the following form: ([ (reactant, stoichiometry), .. ], [ (product, stoichiometry) ..] ). The general scheme for reactions from and to Molecule Classes maps molecules within a MolClass on lhs to molecules in another class on the rhs as follows:

Reaction scheme as MoleculeClass scheme: A + B -> C , where A :{a0, a1, a2}, B:{b0, b1}, C:{c0, c1, c2*} will be translated into:

a0 + b0 -> c0 a1 + b0 -> c1 a2 + b0 -> c2*

a0 + b1 -> c0 a1 + b1 -> c1 a2 + b1 -> c2*

  • If certain molecule species do not exist (e.g. the c2 in the previous example does not

exist, the reaction is omitted from possible sub-reactions, and will therefor not take place. Note that products on the rhs will always be converted in to the species corresponding to the index of the substrate on the lhs. If there is more product than substrates, e.g. A -> C + D where D:{d0, d1}, then there will be subreactions for every possible species of D:

a0 -> c0 + d0 a0 -> c0 + d1

a1 -> c1 + d0 a1 -> c1 + d1

a2 -> c2 + d0 a2 -> c2 + d1

Example 2: F + G -> H + I , where F :{f0, f1, f2}, G:{g0}, H:{h0, h1} , I:{i0, i2} becomes:

f0 + g0 -> h0 + i0 f1 + g0 -> h1 + i0

.

class VirtualMicrobes.event.Reaction.Degradation(substrate, **kwargs)[source]

Bases: VirtualMicrobes.event.Reaction.Reaction

reaction_scheme()[source]
sub_reactions()[source]
class VirtualMicrobes.event.Reaction.Diffusion(substrate, **kwargs)[source]

Bases: VirtualMicrobes.event.Reaction.Reaction

reaction_scheme()[source]
sub_reactions()[source]
class VirtualMicrobes.event.Reaction.Influx(substrate, **kwargs)[source]

Bases: VirtualMicrobes.event.Reaction.Reaction

reaction_scheme()[source]
class VirtualMicrobes.event.Reaction.Reaction(type_, reactants, products, stoichiometry, **kwargs)[source]

Bases: object

A reaction can be associated either with individual molecular species or with a Molecule Classes.

class VirtualMicrobes.event.Reaction.Transport(substrate_class, energy_source_class, cost, **kwargs)[source]

Bases: VirtualMicrobes.event.Reaction.Reaction

init_sub_reaction_dicts()[source]

Write out dictionaries for the sub_reactions generated by sub_reactions()

sub_reactions()[source]

Sub-reactions of Transporters link a specific external substrate to its internal counterpart. Different energy sources yield combinatorial expansion.

VirtualMicrobes.event.Reaction.consumes(reactions)[source]

Set of consumed metabolic species.

Parameters:reactions (iterable of class:Convert or dict) – set of reactions
Returns:set of class
Return type:`event.Molecule.Molecule`s consumed in the reaction set.
VirtualMicrobes.event.Reaction.create_conversions(reaction_stoi_combinations)[source]
VirtualMicrobes.event.Reaction.find_metabolic_closure(input_set, conversions)[source]

Find the autocatalytic closure of metabolites given a set of inputs and reactions.

Iteratively overlap the produced + influxed and consumed metabolites of the set of conversion reactions, yielding a set of ‘potentially autocatalytic metabolites’. Iterate over the set of ‘potentially autocatalytic reactions’ and require that all substrates of the reaction are in the set of ‘potentially autocatalytic’ metabolites. If not, remove the reaction from the ‘potentially autocatalytic’ reaction set.

Parameters:
  • input_set (iterable of event.Molecule.Molecule) – initial set to start expansion of metabolic set
  • conversions (iterable of :class:`Conversion`s) – enzymatic reactions that convert metabolites into other metabolites
Returns:

tuple – molecules and reactions in the core autocatalytic cycle.

Return type:

( set of class:`event.Molecule.Molecule`s , set of :class:`Conversion`s)

VirtualMicrobes.event.Reaction.find_product_set(input_mols, conversions)[source]

Find metabolites that can be produced from a set of input metabolites, given a set of reactions.

Parameters:
  • input_mols (iterable of event.Molecule.Molecule) – initial set to start expansion of metabolic set
  • conversions (iterable of :class:`Conversion`s) – enzymatic reactions that convert metabolites into other metabolites
Returns:

set of produced class

Return type:

`event.Molecule.Molecule`s

VirtualMicrobes.event.Reaction.produces(reactions)[source]

Set of produced metabolic species.

Parameters:reactions (iterable of class:Convert or dict) – set of reactions
Returns:
Return type:set of `event.Molecule.Molecule`s produced in the reaction set.

Module contents

Created on Nov 12, 2013

author:thocu