Ensemble
Ensemble
This is the main class of the EnsembleMaBoSS API, used to build the Ensemble simulation.
- class maboss.ensemble.Ensemble(path, cfg_filename=None, individual_istates={}, individual_mutations={}, individual_cfgs=None, models=None, *args, **kwargs)[source]
- construct a simulation for Ensemble MaBoSS.
- Parameters:
path – folder with bnet files, or zip file with bnet files
cfg_filename – (optional) the path of the cfg file with simulation parameters
individual_istates – (optional) dictionnary containing the initial states of each model
individual_mutations – (optional) dictionnary containing the mutations of each model
models – (optional) list of the sub-ensemble of models within the path to simulate
- Ensemble.mutate(node, state)[source]
- Trigger or untrigger mutation for a node.
- Parameters:
node – The identifier of the node to be modified
State (str) –
'ON'(always up)'OFF'(always down)'WT'(mutable but with normal behaviour)
The node will appear as a mutable node in the bnd file. This means that its rate will be of the form:
rate_up = $LowNode ? 0 :($HighNode ? 1: (@logic ? rt_up : 0))If the node is already mutable, this method will simply set $HighNode and $LowNode accordingly to the desired mutation.
- Ensemble.run(workdir=None, overwrite=False, prefix='res')[source]
- Run the simulation and return a :doc:`ensemblemaboss-api-ensemble` object.
- Parameters:
workdir – (optional) directory where the simulation is to be executed
overwrite – (optional) overwrite a previous simulation in the same workdir
prefix – (optional) prefix of the simulation results files
- Ensemble.set_istate(nodes, probDict, warnings=True)[source]
- Change the inital states probability of one or several nodes.
- Parameters:
nodes (a
Nodeor a list or tuple ofNode) – the node(s) whose initial states are to be modifiedprobDict (dict) – the probability distribution of intial states
If nodes is a Node object or a singleton, probDict must be a probability distribution over {0, 1}, it can be expressed by a list [P(0), P(1)] or a dictionary: {0: P(0), 1: P(1)}.
If nodes is a tuple or a list of several Node objects, the Node object will be bound, and probDict must be a probability distribution over a part of {0, 1}^n. It must be expressed in the form of a dictionary {(b1, …, bn): P(b1,..,bn),…}. States that do not appear in the dictionary will be considered to be impossible. If a state has a 0 probability of being an intial state but might be reached later, it must explicitly appear as a key in probDict.
Example
>>> my_network.set_istate('node1', [0.3, 0.7]) # node1 will have a probability of 0.7 of being up >>> my_network.set_istate(['node1', 'node2'], {(0, 0): 0.4, (1, 0): 0.6, (0, 1): 0}) # node1 and node2 can never be both up because (1, 1) is not in the dictionary