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
Molecule species.
An internally and external variant of each molecule is defined. Molecules can act as metabolites that can be converted in (enzymatic) reactions. Can diffuse over membranes and may be transported into or out of the cell.
-
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)
-
toxic_level
¶
-
-
class
VirtualMicrobes.event.Molecule.
MoleculeClass
(name, molecule_species=None, energy_level=1, is_energy=False, has_building_block=False)[source]¶ Bases:
object
Defines a class of related molecule species.
-
add_molecule
(molecule)[source]¶ Add a molecule to this molecule class.
Parameters: molecule ( VirtualMicrobes.event.Molecule
) – a molecule
-
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
Convert molecules within the same molecule class.
Parameters: - substrate (
VirtualMicrobes.event.Molecule.Molecule
) – molecule to convert - energy (
VirtualMicrobes.event.Molecule.MoleculeClass
) – energy molecule class - product (
VirtualMicrobes.event.Molecule.Molecule
) – product molecule
- substrate (
-
class
VirtualMicrobes.event.Reaction.
Convert
(reactants, products, stoichiometry)[source]¶ Bases:
VirtualMicrobes.event.Reaction.Reaction
Conversion reaction type.
In a conversion reaction a set of reactants react and a set of products are produced. Both reactants and products are defined as
VirtualMicrobes.event.Molecule.MoleculeClass
. Therefore, a single Convert reaction represent a set of sub-reactions of sets of reactant-VirtualMicrobes.event.Molecule.Molecule
, sets of product-VirtualMicrobes.event.Molecule.Molecule
combinations.A pairing rule governs the exact set of sub-reactions that can take place.
Parameters: - reactants (
VirtualMicrobes.event.Molecule.MoleculeClass
) – reactants in reaction - products (
VirtualMicrobes.event.Molecule.MoleculeClass
) – products of reaction - stoichiometry (list of ints) – stoichiometric constants of reaction
-
init_sub_reaction_dicts
()[source]¶ Write out dictionaries for the sub_reactions generated by sub_reactions()
-
prod_species
¶
-
reac_species
¶
-
sub_reactions
()[source]¶ Representation of sub-reactions.
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
.
- reactants (
-
class
VirtualMicrobes.event.Reaction.
Degradation
(substrate, **kwargs)[source]¶ Bases:
VirtualMicrobes.event.Reaction.Reaction
Degradation type reaction.
Represents degradation of a molecule. The reaction has no products. Thus, when molecules degrade, mass is not strictly conserved.
Parameters: substrate ( VirtualMicrobes.event.Molecule.Molecule
) – degrading molecule
-
class
VirtualMicrobes.event.Reaction.
Diffusion
(substrate, **kwargs)[source]¶ Bases:
VirtualMicrobes.event.Reaction.Reaction
Diffusion type reaction.
A reaction representing diffusion over a barrier (here the cell membrane). No products are defined for this reaction. Methods implementing this reaction type will convert the external/internal variant of a
VirtualMicrobes.event.Molecule.Molecule
into the linked internal/external molecule type.Parameters: substrate ( VirtualMicrobes.event.Molecule.Molecule
) – diffusing molecule
-
class
VirtualMicrobes.event.Reaction.
Influx
(substrate, **kwargs)[source]¶ Bases:
VirtualMicrobes.event.Reaction.Reaction
Influx type reaction.
A reaction representing influx of molecules into the environment.
Parameters: substrate ( VirtualMicrobes.event.Molecule.Molecule
) – molecule that fluxes in
-
class
VirtualMicrobes.event.Reaction.
Reaction
(type_, reactants, products, stoichiometry)[source]¶ Bases:
object
Base class for reactions.
Reactions are rules to convert Molecules to other Molecules, or Transport Molecules from one volume to another volume. A reaction specifies its reactants and products as MoleculeClasses or Molecules. Because a MoleculeClass can hold multiple Molecules, one Reaction is in fact a collection of potential molecular reactions. The actualized reactions depend on the properties (binding affinities for specific Molecules) of the enzymes and the availability of Molecules.
Parameters: - type (str) – an identifier for the reaction type
- reactants (list of
VirtualMicrobes.event.Molecule.MoleculeClass
or) –VirtualMicrobes.event.Molecule.Molecule
reactants in the reaction - products (list of
VirtualMicrobes.event.Molecule.MoleculeClass
or) –VirtualMicrobes.event.Molecule.Molecule
products of the reaction - stoichiometry (list of int) – stoichiometric constants determine ratios of participants in the reaction
-
class
VirtualMicrobes.event.Reaction.
Transport
(substrate_class, energy_source_class, sub_stoi, cost, **kwargs)[source]¶ Bases:
VirtualMicrobes.event.Reaction.Reaction
A transport type reaction.
Substrates are transported over a membrane, typically requiring the consumption of an energy source. The substrate and energy source are defined as
VirtualMicrobes.event.Molecule.MoleculeClass
. Therefore, a single Transport reaction represent a set of sub-reactions of substrate-VirtualMicrobes.event.Molecule.Molecule
, energy-VirtualMicrobes.event.Molecule.Molecule
combinations.Parameters: - substrate_class (
VirtualMicrobes.event.Molecule.MoleculeClass
) – the substrate being transported - energy_source_class (
VirtualMicrobes.event.Molecule.MoleculeClass
) – the energy source - sub_stoi (int) – stoichiometric constant for substrate
- cost (int) – stoichiometry of energy cost
- substrate_class (
-
VirtualMicrobes.event.Reaction.
consumes
(reactions)[source]¶ Set of consumed metabolic species.
Parameters: reactions (iterable of Convert
or dict) – set of reactionsReturns: Return type: set of :class:`VirtualMicrobes.event.Molecule.Molecule`s consumed in the reaction set.
-
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
VirtualMicrobes.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:`VirtualMicrobes.event.Molecule.Molecule`s , set of :class:`Conversion`s)
- input_set (iterable of
-
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
VirtualMicrobes.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: Return type: set of produced :class:`VirtualMicrobes.event.Molecule.Molecule`s
- input_mols (iterable of