AChemKit.randomnet

Functions that construct random ReactionNetwork instances by various methods.

Functions

Linear(natoms, maxlength, pform, pbreak[, ...]) Generates a random ReactionNetwork from molecules that are strings of atoms and can join together or break apart.
Uniform(nmols, nreactions, nreactants, nproducts) Generates a random ReactionNetwork by assigning reaction randomly between all molecular species.

Classes

ReactionNetwork(rates) A dictionary of reactions where each key is a reaction composed of (tuple(sorted(reactants)), sorted(tuple(products))) and each value is the rate.
AChemKit.randomnet.Uniform(nmols, nreactions, nreactants, nproducts, rates=1.0, cls=<class 'AChemKit.reactionnet.ReactionNetwork'>, rng=None)

Generates a random ReactionNetwork by assigning reaction randomly between all molecular species.

Arguments:

nmols
Number of molecules in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

Note

ReactionNetwork tracks molecules by their reactions, so if a molecule is not part of any reaction it will not appear at all e.g. in seen(). This could lead to differences from nmols.

nreactions
Number of reaction in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

Note

The value of nreactions is the number of times a reaction will be added to the ReactionNetwork. If it is already in the ReactionNetwork, it will be replaced. This can lead to ReactionNetwork with less than nreactions reactions.

nreactants

Number of reactants for each reaction in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

Note

If this is a tuple/list it will be sampled for each reaction.

nproducts

Number of products for each reaction in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

If this is None, then nreactants must be a tuple of (nreactants, nproducts) or a list of tuples.

Note

If this is a tuple/list it will be sampled for each reaction.

rates

Rate of each reaction in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

Note

If this is a tuple/list it will be sampled for each reaction.

cls
Alternative class to use for constructing the return rather than ReactionNetwork.
rng
Random number generator to use. If not specifed, one will be generated at random.

These arguments can be a single value or a tuple/list which will be uniformly sampled from.

For example:

Uniform(5,3,2,1) will generate 5 molecules with 3 reactions between them where each reaction has two reactants and one product.

Uniform(5,3,(1,2), (1,2)) will generate 5 molecules with 3 reactions between them where each reaction has one or two reactants and one or two products.

Uniform(5,3,((2,1),(1,2)), None) will generate 5 molecules with 3 reactions between them where each reaction has either two reactants and one product or one reactant and two products.

AChemKit.randomnet.Linear(natoms, maxlength, pform, pbreak, directed=True, rates=1.0, cls=<class 'AChemKit.reactionnet.ReactionNetwork'>, rng=None)

Generates a random ReactionNetwork from molecules that are strings of atoms and can join together or break apart.

Based on the paper Autocatalytic sets of proteins. 1986. Journal of Theoretical Biology 119:1-24 by Kauffman, Stuart A. but without the explicit catalytic activity.

Arguments:

natoms
Number of atoms to use. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).

Note

ReactionNetwork tracks molecules by their reactions, so if a molecule is not part of any reaction it will not appear at all e.g. in seen().

maxlength
Maximum number of atoms in a molecule. If this is None, then they are unbounded; this might cause problems with a computational explosion. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).
pform
Probability that a pair of molecules will join together per orientation. Must be between 0 and 1. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).
pbreak
Probability that any pair of atoms will break. Must be between 0 and 1.
directed
If false, molecules have no intrinsic direction so AlphBeta is equivlanet to BetaAlpha. NOT IMPLEMENTED
rates
Rate of each reaction in the reaction network. Can be a single value or a tuple/list which will be uniformly sampled from (duplicates can be used to give a non-uniform distribution).
cls
Alternative class to use for constructing the return rather than ReactionNetwork.
rng
Random number generator to use. If not specifed, one will be generated at random.

Previous topic

AChemKit.reactionnet

Next topic

AChemKit.properties

This Page