bionetgen.network package
Submodules
bionetgen.network.blocks module
- class bionetgen.network.blocks.NetworkBlock[source]
Bases:
object
Base block object that will be used for each block in the network.
Attributes
- namestr
Name of the block which will be used to write the BNGL text
- comment(str, str)
comment at the begin {block} or end {block} statements, tuple
- itemsOrderedDict
all the model objects in the block
Methods
- add_item((name,value))
sets self.item[name] = value to add a particular model object into a block
- add_items(item_list)
loops over every element in the list and uses add_item on it
- gen_string()
for every block this method generates the BNGL string of the block. it has to be overwritten for each block.
- class bionetgen.network.blocks.NetworkCompartmentBlock[source]
Bases:
NetworkBlock
Compartment block object, subclass of ModelBlock.
Methods
- add_compartment(name, dim, size, outside=None)
adds a compartment by making a new Compartment object and passing the args/kwargs to its initialization.
- class bionetgen.network.blocks.NetworkEnergyPatternBlock[source]
Bases:
NetworkBlock
Energy pattern block object, subclass of NetworkBlock.
Methods
- add_energy_pattern(id, pattern, expression)
adds an energy pattern by making a new EnergyPattern object and passing the args/kwargs to its initialization.
- class bionetgen.network.blocks.NetworkFunctionBlock[source]
Bases:
NetworkBlock
Function block object, subclass of NetworkBlock.
Methods
- add_function(name, name, expr, args=None)
adds a function by making a new Function object and passing the args/kwargs to its initialization.
- class bionetgen.network.blocks.NetworkGroupBlock[source]
Bases:
NetworkBlock
Group block object, subclass of NetworkBlock.
Methods
- add_group(name, otype, patterns=[])
adds an group by making a new NetworkGroup object and passing the args/kwargs to its initialization.
- class bionetgen.network.blocks.NetworkParameterBlock[source]
Bases:
NetworkBlock
Parameter block object, subclass of ModelBlock.
Methods
- add_parameter(name, value, expr=None)
adds a parameter by making a new Parameter object and passing the args/kwargs to its initialization.
- class bionetgen.network.blocks.NetworkPopulationMapBlock[source]
Bases:
NetworkBlock
Population map block object, subclass of NetworkBlock.
Methods
- add_population_map(id, struct_species, pop_species, rate)
adds a population map by making a new PopulationMap object and passing the args/kwargs to its initialization
- class bionetgen.network.blocks.NetworkReactionBlock[source]
Bases:
NetworkBlock
Rule block object, subclass of NetworkBlock.
Methods
- add_rule(name, name, reactants=[], products=[], rate_constants=())
adds a rule by making a new Rule object and passing the args/kwargs to its initialization.
- consolidate_rulesNone
XML loading makes it so that reversible rules are split into two unidirectional rules. This find them and combines them into a single rule to correctly represent the original model rule.
- class bionetgen.network.blocks.NetworkSpeciesBlock[source]
Bases:
NetworkBlock
Species block object, subclass of NetworkBlock.
Methods
- add_species(name, pattern=Pattern(), count=0)
adds a species by making a new Species object and passing the args/kwargs to its initialization.
bionetgen.network.network module
- class bionetgen.network.network.Network(bngl_model, BNGPATH='/home/docs/checkouts/readthedocs.org/user_builds/pybionetgen/checkouts/latest/bionetgen/bng-linux')[source]
Bases:
object
Main model object and entry point for model API. The goal of this object is to generate and read the BNGXML of a given BNGL model and give the user a pythonic interface to the resulting model object.
- Usage: bngmodel(bng_model)
bngmodel(bng_model, BNGPATH)
Attributes
- active_blockslist[str]
a list of the blocks that have been parsed in the model
- bngnetworkparserBNGNetworkParser
BNGParser object that’s responsible for .bngl file reading and model setup
- network_namestr
name of the model, generally set from the given BNGL file
Methods
- write_model(model_name)
write the model in BNGL format to the path given
- setup_simulator(sim_type)
sets up a simulator in bngmodel.simulator where the only current supported type of simulator is libRR for libRoadRunner simulator.
bionetgen.network.networkparser module
- class bionetgen.network.networkparser.BNGNetworkParser(path)[source]
Bases:
object
Parser object that deals with reading in the BNGL file and setting up the model object
- Usage: BNGParser(bngl_path)
BNGParser(bngl_path, BNGPATH)
Attributes
- bngfileBNGFile
BNGFile object that’s responsible for .bngl file manipulations
Methods
- parse_model(model_file)
parses the BNGL model at the given path and adds everything to a given model object
- parse_xml(xml_str)
parses given xml string and adds everything to a given model object
bionetgen.network.structs module
- class bionetgen.network.structs.NetworkCompartment(name, dim, size, outside=None)[source]
Bases:
NetworkObj
Class for all compartments in the network, subclass of NetworkObj.
- In BNGL the compartments are of the form
compartment_name dimensions size
Attributes
- namestr
name of the compartment
- dimstr
dimensionality of the compartment
- sizestr
size/volume of the compartment
- outsidestr
parent compartment, if exists
- class bionetgen.network.structs.NetworkEnergyPattern(name, pattern, expression)[source]
Bases:
NetworkObj
Class for all energy patterns in the network, subclass of NetworkObj.
- In BNGL the energy patterns are of the form
EP_pattern EP_expression
Attributes
- namestr
id of the energy pattern
- patternPattern
Pattern object representing the energy pattern
- expressionstr
expression used for energy pattern
- class bionetgen.network.structs.NetworkFunction(name, expr, args=None)[source]
Bases:
NetworkObj
Class for all functions in the network, subclass of NetworkObj.
- In BNGL functions are of the form
function_name function_expression
Attributes
- namestr
name of the function
- exprstr
function expression
- argslist
optional list of arguments for the function
- class bionetgen.network.structs.NetworkGroup(gid, name, members=[], comment='')[source]
Bases:
NetworkObj
Class for all groups in the network, subclass of NetworkObj.
- In BNGL networks the groups are of the form
group_ID group_name group_species
where species are separated by commas.
Attributes
- idstr
id of the group
- namestr
name of the group
- specieslist[expr]
list of species expressions of the group
- class bionetgen.network.structs.NetworkObj[source]
Bases:
object
The base class for all items in a network object (parameter, groups etc.).
Attributes
- commentstr
comment at the end of the line/object
- line_labelstr
line label at the beginning of the line/object
Methods
- print_line()
generates the actual line string with line label and comments if applicable
- gen_string()
generates the BNGL string of the object itself, separate from line attributes
- property comment: None
- property line_label: str
- class bionetgen.network.structs.NetworkParameter(pid, name, value, comment='')[source]
Bases:
NetworkObj
Class for all parameters in the network, subclass of NetworkObj.
- In BNGL networks parameters are of the form
parameter_ID parameter_name parameter_value/expression # comment
Attributes
- idint
ID/line label of the network parameter
- namestr
name of the network parameter
- valuestr
value of the network parameter
- class bionetgen.network.structs.NetworkPopulationMap(name, struct_species, pop_species, rate)[source]
Bases:
NetworkObj
Class for all population maps in the model, subclass of ModelObj.
- In BNGL the population maps are of the form
structured_species -> population_species lumping_parameter
Attributes
- namestr
id of the population map
- struct_speciesPattern
Pattern object representing the species to be mapped
- pop_speciesPattern
Pattern object representing the population count
- ratestr
lumping parameter used in population mapping
- class bionetgen.network.structs.NetworkReaction(rid, reactants=[], products=[], rate_constant=None, comment=None)[source]
Bases:
NetworkObj
Class for all reactions in the network, subclass of NetworkObj.
Attributes
- namestr
name of the rule, optional
- reactantslist[Pattern]
list of patterns for reactants
- productslist[Pattern]
list of patterns for products
- rule_modRuleMod
modifier (moveConnected, TotalRate, etc.) used by a given rule
- operationslist[Operation]
list of operations
- class bionetgen.network.structs.NetworkSpecies(sid, name, count=0, comment='')[source]
Bases:
NetworkObj
Class for all species in the network, subclass of NetworkObj.
- In BNGL the species/seed species are of the form
species count
where species is a single pattern and count is the starting value for that specific pattern
Attributes
- patternPattern
pattern of the seed species
- countstr
starting value of the seed species