Random Network Building Utilities

A module for creating random network models

class buildNetworks.Settings[source]

Settings to control some properties of the network generation

rateConstantScale = 1.0

How much the rate cosntants are scaled by. By default rate constants ge values between 0 and 1.0

allowMassViolatingReactions = False

If set to true, reactions such as A + B -> A are allowed

addDegradationSteps = False

Set true if you want every floating node (not boundary nodes) to have a degradation step

removeBoundarySpecies = True

Set true if you want and sink and source species to be classed as boundary species

class ReactionProbabilities[source]

Defines the probabilities of generating different reaction mechanisms. Current probabilities are:

UniUni = 0.3 BiUni = 0.3 UniBi = 0.3 BiBi = 0.1

restoreDefaultProbabilities()[source]

Restore the default settings for the reaction mechanism propabilities

buildNetworks.getLinearChain(lengthOfChain, rateLawType='MassAction', keqRatio=5)[source]

Return an Antimony string for a linear chain

Parameters:
  • lengthOfChain (integer) – Length of generated chain, number of reactions

  • rateLawType (string) – Optional, can be ‘MassAction’ (default), ‘ModifiedMassAction’ or ‘Michaelis’

  • keqRatio (float) – Optional, maximum size of equilibrium constant

Returns:

string – Returns an Antimony string representing the network model

Examples:

>>> s = teUtils.buildNetworks.getLinearChain (6, rateLawType='MassAction')
>>> r = te.loada (s)
>>> r.simulate (0, 50, 100)
>>> r.plot()
buildNetworks.getRandomNetworkDataStructure(nSpecies, nReactions, isReversible=False, randomSeed=-1, returnStoichiometryMatrix=False)[source]

Return a random network in the form of a data stucture containing the floating species, boundary species and reaction list

Parameters:
  • nSpecies (integer) – Maximum number of species

  • nreaction (integer) – Maximum number of reactions

  • isReversible (boolean) – Set True if the reactions should be reversible

  • randomSeed – Set this to a positive number if you want to set the random number genreator seed (allow repeatabiliy of a run)

Returns:

Returns a list structure representing the network model reactionList = [numSpecies, reaction, reaction, ….] reaction = [reactionType, [list of reactants], [list of products], rateConstant]

buildNetworks.getRandomNetwork(nSpecies, nReactions, isReversible=False, returnStoichiometryMatrix=False, randomSeed=-1, returnFullStoichiometryMatrix=False)[source]

Generate a random network using uniuni, unibi, biuni, and bibi reactions. All reactions are governed by mass-action kinetics. User can set the maximum number of reactions and species.

Parameters:
  • nSpecies (integer) – Maximum number of species

  • nreaction (integer) – Maximum number of reactions

  • isReversible (boolean) – Set True if the reactions should be reversible

  • returnStoichiometryMatrix (boolean) – Set True to make the function return the stoichiometry matrix that only inludes the floating species. If you want the full stoichiometriy matrix that includes the boundary species as well, set the returnFullStoichiometryMatrix to True

  • randomSeed – Set this to a positive number if you want to set the random number genreator seed (allow repeatabiliy of a run)

  • returnFullStoichiometryMatrix (boolean) – Set True if you want the full stoichometry matrix returned. The full matrix will include any boundary species in the network.

Returns:

string – Returns an Antimony string representing the network model

Examples:

>>> model = getRandomNetwork (6, 9)
>>> r = te.loada(model)
>>> m = r.simulate (0, 10, 100)

>>> model = getRandomNetwork (6, 7, returnStoichiometryMatrix=True)

  array([[ 0.,  0.,  1.,  0., -1.,  0.,  0.],
        [ 1.,  0.,  0.,  1.,  0., -1.,  1.],
        [-1.,  1.,  0.,  0.,  0.,  0.,  0.],
        [ 0.,  0.,  1.,  0.,  0.,  0., -1.],
        [ 0., -1.,  0., -1.,  0.,  1.,  0.],
        [ 0.,  0., -1.,  0.,  1.,  0.,  0.]])