Methods

Generating a singular model (as a string variable)

SBbadger.generate.model(verbose_exceptions=False, output_dir='models', group_name='test', overwrite=True, n_species=10, n_reactions=None, in_dist='random', out_dist='random', joint_dist=None, in_range=None, out_range=None, joint_range=None, min_freq=1.0, mass_violating_reactions=True, unaffected_nodes=True, connected=True, edge_type='generic', kinetics=None, add_enzyme=False, mod_reg=None, gma_reg=None, sc_reg=None, allo_reg=None, rxn_prob=None, rev_prob=0, ic_params=None, dist_plots=False, net_plots=False, net_layout='default', str_format='ant', mass_balanced=False, independent_sampling=False, constants=None, source=None, sink=None, cobra=False, network_attempts=100, distribution_attempts=100)

Generates a single model as an Antimony or SBML string. This function runs the complete workflow for model generation including truncation and re-normalization of the distributions, reaction selection and construction of the network, and the imposition of rate-laws. Outputs include distribution data and figure, network data and figure, and the final model in Antimony and SBML formats.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_species – Number of species per model.

  • n_reactions – Specifies the minimum number of reactions per model. Only valid in the completely random case.

  • out_dist – Describes the out-edge distribution function, the discrete distribution, or the frequency distribution.

  • in_dist – Describes the in-edge distribution function, discrete distribution, or frequency distribution.

  • joint_dist – Describes the joint distribution function, discrete distribution, or frequency distribution.

  • in_range – The degree range for the in-edge distribution.

  • out_range – The degree range for the out-edge distribution.

  • joint_range – The degree range for the joint distribution (must be symmetrical, see examples).

  • min_freq – Sets the minimum number (expected value) of nodes (species) that must be in each degree bin.

  • mass_violating_reactions – Allow apparent mass violating reactions such as A + B -> A.

  • unaffected_nodes – Allow reactions in which some species is left unchanged such as A + B -> A + C.

  • edge_type – Determines how the edges are counted against the frequency distributions. Current options are ‘generic’ and ‘metabolic’.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • mod_reg – Describes the modular modifiers. Only valid for modular rate-laws.

  • gma_reg – Describes the generalized mass-action (gma) modifiers. Only valid for gma rate-laws.

  • sc_reg – Describes the saturating and cooperative (sc) modifiers. Only valid for sc rate-laws.

  • allo_reg – Describes general allosteric regulation derived from the modular rate laws but applied to anything.

  • rxn_prob – Describes the reaction probabilities. Defaults to [UniUni, BiUni, UniBi, BiBI] = [0.35, 0.3, 0.3, 0.05]

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • dist_plots – Generate distribution charts.

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • str_format – Determines the format of the output string, antimony or sbml. Defaults to ant.

  • mass_balanced – Enforces consistency of the stoichiometric matrix.

  • connected – Force networks to be fully connected.

  • independent_sampling – Forces both distributions to be sampled independently.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

  • cobra – renames the synthesis and degradation (no constants) to cobra format.

  • network_attempts – The number of network construction attempts made. Defaults to 100.

  • distribution_attempts – The number of distribution reconciliation attempts made. Defaults to 100.

Generating a collection of Models

SBbadger.generate.models(verbose_exceptions=False, output_dir='models', group_name='test', overwrite=True, n_models=1, n_species=10, n_reactions=None, in_dist='random', out_dist='random', joint_dist=None, in_range=None, out_range=None, joint_range=None, min_freq=1.0, mass_violating_reactions=True, unaffected_nodes=True, connected=True, edge_type='generic', kinetics=None, add_enzyme=False, mod_reg=None, gma_reg=None, sc_reg=None, allo_reg=None, rxn_prob=None, rev_prob=0, ic_params=None, dist_plots=False, net_plots=False, net_layout='default', n_cpus=1, mass_balanced=False, independent_sampling=False, constants=None, source=None, sink=None, cobra=False, network_attempts=100, distribution_attempts=100)

Generates a collection of models. This function runs the complete workflow for model generation including truncation and re-normalization of the distributions, reaction selection and construction of the network, and the imposition of rate-laws. Outputs include distribution data and figures, network data and figures, and the final models in Antimony and SBML formats.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_models – Number of models to produce.

  • n_species – Number of species per model.

  • n_reactions – Specifies the minimum number of reactions per model. Only valid in the completely random case.

  • out_dist – Describes the out-edge distribution function, the discrete distribution, or the frequency distribution.

  • in_dist – Describes the in-edge distribution function, discrete distribution, or frequency distribution.

  • joint_dist – Describes the joint distribution function, discrete distribution, or frequency distribution.

  • in_range – The degree range for the in-edge distribution.

  • out_range – The degree range for the out-edge distribution.

  • joint_range – The degree range for the joint distribution (must be symmetrical, see examples).

  • min_freq – Sets the minimum number (expected value) of nodes (species) that must be in each degree bin.

  • mass_violating_reactions – Allow apparent mass violating reactions such as A + B -> A.

  • unaffected_nodes – Allow reactions in which some species is left unchanged such as A + B -> A + C.

  • edge_type – Determines how the edges are counted against the frequency distributions. Current options are ‘generic’ and ‘metabolic’.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • mod_reg – Describes the modular modifiers. Only valid for modular rate-laws.

  • gma_reg – Describes the generalized mass-action (gma) modifiers. Only valid for gma rate-laws.

  • sc_reg – Describes the saturating and cooperative (sc) modifiers. Only valid for sc rate-laws.

  • allo_reg – Describes general allosteric regulation derived from the modular rate laws but applied to anything.

  • rxn_prob – Describes the reaction probabilities. Defaults to [UniUni, BiUni, UniBi, BiBI] = [0.35, 0.3, 0.3, 0.05]

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • dist_plots – Generate distribution charts.

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • n_cpus – Provides the number of cores to be used in parallel.

  • mass_balanced – Enforces consistency of the stoichiometric matrix.

  • connected – Force networks to be fully connected.

  • independent_sampling – Forces both distributions to be sampled independently.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

  • cobra – renames the synthesis and degradation (no constants) to cobra format.

  • network_attempts – The number of network construction attempts made. Defaults to 100.

  • distribution_attempts – The number of distribution reconciliation attempts made. Defaults to 100.

Generating Distributions

SBbadger.generate.distributions(verbose_exceptions=False, output_dir='models', group_name='test', overwrite=True, n_models=1, n_species=10, out_dist='random', in_dist='random', joint_dist=None, in_range=None, out_range=None, joint_range=None, min_freq=1.0, dist_plots=False, n_cpus=1, independent_sampling=False, distribution_attempts=100)

Generates a collection of frequency distributions from function or bound discrete probabilities. Outputs include distribution data and figures.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_models – Number of models to produce.

  • n_species – Number of species per model.

  • out_dist – Describes the out-edge distribution function, the discrete distribution, or the frequency distribution.

  • in_dist – Describes the in-edge distribution function, discrete distribution, or frequency distribution.

  • joint_dist – Describes the joint distribution function, discrete distribution, or frequency distribution.

  • in_range – The degree range for the in-edge distribution.

  • out_range – The degree range for the out-edge distribution.

  • joint_range – The degree range for the joint distribution (must be symmetrical, see examples).

  • min_freq – Sets the minimum number (expected value) of nodes (species) that must be in each degree bin.

  • dist_plots – Generate distribution charts.

  • n_cpus – Provides the number of cores to be used in parallel.

  • independent_sampling – Forces both distributions to be sampled independently.

  • distribution_attempts – The number of distribution reconciliation attempts made. Defaults to 100.

Generating Networks

SBbadger.generate.networks(verbose_exceptions=False, directory='models', group_name='test', overwrite=True, n_reactions=None, mass_violating_reactions=True, unaffected_nodes=True, connected=True, edge_type='generic', mod_reg=None, gma_reg=None, sc_reg=None, allo_reg=None, rxn_prob=None, net_plots=False, net_layout='default', n_cpus=1, mass_balanced=False, network_attempts=100)

Generates a collection of reaction networks. This function requires the existence of previously generated frequency distributions.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • directory – Directory where files are read and stored.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_reactions – Specifies the minimum number of reactions per model. Only valid in the completely random case.

  • mass_violating_reactions – Allow apparent mass violating reactions such as A + B -> A.

  • unaffected_nodes – Allow reactions in which some species is left unchanged such as A + B -> A + C.

  • edge_type – Determines how the edges are counted against the frequency distributions. Current options are ‘generic’ and ‘metabolic’.

  • mod_reg – Describes the modular modifiers. Only valid for modular rate-laws.

  • gma_reg – Describes the generalized mass-action (gma) modifiers. Only valid for gma rate-laws.

  • sc_reg – Describes the saturating and cooperative (sc) modifiers. Only valid for sc rate-laws.

  • allo_reg – Describes general allosteric regulation derived from the modular rate laws but applied to anything.

  • rxn_prob – Describes the reaction probabilities. Defaults to [UniUni, BiUni, UniBi, BiBI] = [0.35, 0.3, 0.3, 0.05].

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • n_cpus – Provides the number of cores to be used in parallel.

  • mass_balanced – Enforces consistency of the stoichiometric matrix.

  • connected – Force networks to be fully connected.

  • network_attempts – The number of network construction attempts made. Defaults to 100.

Applying Rate-Laws

SBbadger.generate.rate_laws(verbose_exceptions=False, directory='models', group_name='test', overwrite=True, kinetics=None, add_enzyme=False, mod_reg=None, gma_reg=None, sc_reg=None, allo_reg=None, rxn_prob=None, rev_prob=0, ic_params=None, n_cpus=1, constants=None, source=None, sink=None, cobra=False, net_plots=True, net_layout='default')

Generates a collection of models. This function requires the existence of previously generated networks.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • directory – Directory where files are read and stored.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • mod_reg – Describes the modular modifiers. Only valid for modular rate-laws.

  • gma_reg – Describes the generalized mass-action (gma) modifiers. Only valid for gma rate-laws.

  • sc_reg – Describes the saturating and cooperative (sc) modifiers. Only valid for sc rate-laws.

  • allo_reg – Describes general allosteric regulation derived from the modular rate laws but applied to anything.

  • rxn_prob – Describes the reaction probabilities. Defaults to [UniUni, BiUni, UniBi, BiBI] = [0.35, 0.3, 0.3, 0.05]

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • n_cpus – Provides the number of cores to be used in parallel.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

  • cobra – renames the synthesis and degradation (no constants) to cobra format.

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

Standard Networks

Linear

SBbadger.generate.linear(verbose_exceptions=False, output_dir='models', group_name='linear', overwrite=True, n_models=1, n_species=10, kinetics=None, allo_reg=None, add_enzyme=False, rev_prob=0, ic_params=None, net_plots=False, net_layout='dot', n_cpus=1, constants=None, source=None, sink=None)

Generates a collection of UNI-UNI linear models.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_models – Number of models to produce.

  • n_species – Number of species per model.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • allo_reg – This is a future feature.

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • n_cpus – Provides the number of cores to be used in parallel.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

Cyclic

SBbadger.generate.cyclic(verbose_exceptions=False, output_dir='models', group_name='cyclic', overwrite=True, min_species=10, max_species=20, n_cycles=1, n_models=1, kinetics=None, allo_reg=None, add_enzyme=False, rev_prob=0, ic_params=None, net_plots=False, net_layout='dot', n_cpus=1, constants=None, source=None, sink=None)

Generates a collection of UNI-UNI cyclic models.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • min_species – Minimum number of species per cycle.

  • max_species – Maximum number of species per cycle.

  • n_cycles – Number of cycles per model.

  • n_models – Number of models to produce.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • allo_reg – This is a future feature.

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • n_cpus – Provides the number of cores to be used in parallel.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

Branched

SBbadger.generate.branched(verbose_exceptions=False, output_dir='models', group_name='branched', overwrite=True, n_models=1, n_species=20, seeds=1, path_probs=None, tips=False, kinetics=None, allo_reg=None, add_enzyme=False, rev_prob=0, ic_params=None, net_plots=False, net_layout='dot', n_cpus=1, constants=None, source=None, sink=None)

Generates a collection of UNI-UNI branched models from a set of seed nodes.

Parameters:
  • verbose_exceptions – Traceback for input errors are suppressed.

  • output_dir – Output directory.

  • group_name – Name of the group the models belong too and the directory they will be placed in.

  • overwrite – Overwrite the models in output_dir/models/group_name.

  • n_models – Number of models to produce.

  • n_species – Number of species per model.

  • seeds – The number of seed nodes that the network(s) will grow from

  • path_probs – list of probabilities that govern the rate of branching and converging. Defaults to [branch, grow, combine] = [0.1, 0.8, 0.1].

  • tips – Confines branching, growth, and converging to the tip of the stems.

  • kinetics – Describes the desired rate-laws and parameter ranges. Defaults to [‘mass_action’, ‘loguniform’, [‘kf’, ‘kr’, ‘kc’], [[0.01, 1], [0.01, 1], [0.01, 1]]]

  • allo_reg – This is a future feature.

  • add_enzyme – Add a multiplicative parameter to the rate-law that may be used for perturbation analysis.

  • rev_prob – Describes the probability that a reaction is reversible.

  • ic_params – Describes the initial condition sampling distributions. Defaults to [‘uniform’, 0, 10]

  • net_plots – Generate network plots.

  • net_layout – Set layout for network plots.

  • n_cpus – Provides the number of cores to be used in parallel.

  • constants – Use constants for boundary nodes instead of syn and deg reactions. Defaults to None. If constants=None the number of boundary nodes will be happenstance. If constants=False a minimum number of source and sink edges can be set via the source and sink arguments If constants=True a minimum number of source and sink boundary nodes can be set via the source and sink arguments

  • source – Describes the number of source nodes (nodes with synthesis reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary source nodes will always have synthesis reactions.

  • sink – Describes the number of sink nodes (nodes with degradation reactions) and the associated parameter distributions. Defaults to [0, ‘loguniform’, 0.01, 1] where the first position holds the minimum number and the last two are the distribution parameters. Note that boundary sink nodes will always have degradation reactions.

Note: all the above methods, aside from generate.model, use python multiprocessing to generate models or their components in parallel. To generate them serially use generate_serial.<method>. The only difference is the absence of the n_cpus argument.