7.1.1.1.1. intro_to_wc_modeling.cell_modeling.simulation package¶
7.1.1.1.1.1. Subpackages¶
- 7.1.1.1.1.1.1. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm package
- 7.1.1.1.1.1.1.1. Submodules
- 7.1.1.1.1.1.1.2. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm.analysis module
- 7.1.1.1.1.1.1.3. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm.model module
- 7.1.1.1.1.1.1.4. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm.simulation module
- 7.1.1.1.1.1.1.5. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm.submodel_simulation module
- 7.1.1.1.1.1.1.6. intro_to_wc_modeling.cell_modeling.simulation.multi_algorithm.util module
- 7.1.1.1.1.1.1.7. Module contents
7.1.1.1.1.2. Submodules¶
7.1.1.1.1.3. intro_to_wc_modeling.cell_modeling.simulation.boolean module¶
Boolean simulation tutorial
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2017-06-22
- Copyright
2017, Karr Lab
- License
MIT
-
intro_to_wc_modeling.cell_modeling.simulation.boolean.
deterministic_async_update_scheme
(regulatory_functions, step, current_state)[source]¶ Asynchronously update species values in a deterministic order
- Parameters
regulatory_functions (
dict
ofstr
,function
) – dictionary of regulatory functions for each speciesstep (
int
) – step iterationcurrent_state (
dict
ofstr
,bool
) – dictionary of values of each species
- Returns
dictionary of values of each species
- Return type
dict
ofstr
,bool
-
intro_to_wc_modeling.cell_modeling.simulation.boolean.
random_async_update_scheme
(regulatory_functions, step, current_state)[source]¶ Asynchronously update species values in a random order
- Parameters
regulatory_functions (
dict
ofstr
,function
) – dictionary of regulatory functions for each speciesstep (
int
) – step iterationcurrent_state (
dict
ofstr
,bool
) – dictionary of values of each species
- Returns
dictionary of values of each species
- Return type
dict
ofstr
,bool
-
intro_to_wc_modeling.cell_modeling.simulation.boolean.
simulate
(regulatory_functions, initial_state, n_steps, update_scheme)[source]¶ Simulates a Boolean network for
n_steps
usingupdate_scheme
- Parameters
regulatory_functions (
dict
ofstr
,function
) – dictionary of regulatory lambda functions for each speciesinitial_state (
dict
ofstr
,bool
) – dictionary of initial values of each speciesn_steps (
int
) – number of steps to simulateupdate_scheme (
method
) – update schema
- Returns
numpy.ndarray
: array of step numbersdict
ofstr
,numpy.ndarray
: dictionary of histories of each species
- Return type
tuple
-
intro_to_wc_modeling.cell_modeling.simulation.boolean.
sync_update_scheme
(regulatory_functions, step, current_state)[source]¶ Synchronously update species values
- Parameters
regulatory_functions (
dict
ofstr
,function
) – dictionary of regulatory functions for each speciesstep (
int
) – step iterationcurrent_state (
dict
ofstr
,bool
) – dictionary of values of each species
- Returns
dictionary of values of each species
- Return type
dict
ofstr
,bool
7.1.1.1.1.4. intro_to_wc_modeling.cell_modeling.simulation.dfba module¶
dFBA simulation tutorial
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Author
Arthur Goldberg, Arthur.Goldberg@mssm.edu
- Date
2017-06-22
- Copyright
2017, Karr Lab
- License
MIT
7.1.1.1.1.5. intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods module¶
Stochastic simulation tutorial
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2017-08-30
- Copyright
2017, Karr Lab
- License
MIT
-
class
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.
CmeSimulation
(k_m=5, k_n=20, gamma_m=13.862943611198906, gamma_n=0.06931471805599453, m_min=None, m_max=None, n_min=None, n_max=None, p_0=None)[source]¶ Bases:
object
Represents a CME simulation of mRNA and protein synthesis and degradation
-
p_0
[source]¶ matrix of initial probability of each combination of mRNA and protein number (dimensionless)
- Type
float
-
dp_dt
(p_part_vec)[source]¶ Calculate the time derivative of the probability of each (mRNA, protein) state
- Parameters
p_part_vec (
numpy.array
) – vector of probability of each (mRNA, protein) state (dimensionless)- Returns
- vector of size ((m_max - m_min + 1) * (n_max - n_min + 1), 1) that represents
mRNA = {m_min .. m_max} and protein = {n_min .. n_max}
- Return type
numpy.array
-
full_matrix_to_partial_matrix
(full_matrix)[source]¶ Convert a full matrix to a partial vector
- Parameters
full_matrix (
numpy.array
) – matrix with size (m_max + 1, n_max + 1) that represents mRNA = {0 .. m_max} and protein = {0 .. n_max}- Returns
- matrix with size (m_max - m_min + 1, n_max - n_min + 1) that represents
mRNA = {m_min .. m_max} and protein = {n_min .. n_max}
- Return type
numpy.array
-
full_matrix_to_partial_vector
(full_matrix)[source]¶ Convert a full matrix to a partial vector
- Parameters
full_matrix (
numpy.array
) – matrix with size (m_max + 1, n_max + 1) that represents mRNA = {0 .. m_max} and protein = {0 .. n_max}- Returns
- vector of size ((m_max - m_min + 1) * (n_max - n_min + 1), 1) that represents
mRNA = {m_min .. m_max} and protein = {n_min .. n_max}
- Return type
numpy.array
-
get_steady_state
()[source]¶ Calculate the steady state probability distribution
- Returns
steay-state probability of each (mRNA, protein) state (dimensionless)
- Return type
numpy.array
-
partial_matrix_to_full_matrix
(partial_matrix)[source]¶ Convert a partial vector to a full matrix
- Parameters
partial_matrix (
numpy.array
) – matrix with size (m_max - m_min + 1, n_max - n_min + 1) that represents mRNA = {m_min .. m_max} and protein = {n_min .. n_max}- Returns
- matrix with size (m_max + 1, n_max + 1) that represents
mRNA = {0 .. m_max} and protein = {0 .. n_max}
- Return type
numpy.array
-
partial_matrix_to_partial_vector
(mat)[source]¶ Convert a partial matrix to a partial vector
- Parameters
mat (
numpy.array
) – matrix with size (m_max - m_min + 1, n_max - n_min + 1) that represents mRNA = {m_min .. m_max} and protein = {n_min .. n_max}- Returns
- vector of size ((m_max - m_min + 1) * (n_max - n_min + 1), 1) that represents
mRNA = {m_min .. m_max} and protein = {n_min .. n_max}
- Return type
numpy.array
-
partial_vector_to_full_matrix
(partial_vector)[source]¶ Convert a partial vector to a full matrix
- Parameters
partial_vector (
numpy.array
) – vector of size ((m_max - m_min + 1) * (n_max - n_min + 1), 1) that represents mRNA = {m_min .. m_max} and protein = {n_min .. n_max}- Returns
- matrix with size (m_max + 1, n_max + 1) that represents
mRNA = {0 .. m_max} and protein = {0 .. n_max}
- Return type
numpy.array
-
partial_vector_to_partial_matrix
(vec)[source]¶ Convert a partial vector to a partial matrix
- Parameters
vec (
numpy.array
) – vector of size ((m_max - m_min + 1) * (n_max - n_min + 1), 1) that represents mRNA = {m_min .. m_max} and protein = {n_min .. n_max}- Returns
- matrix with size (m_max - m_min + 1, n_max - n_min + 1) that represents
mRNA = {m_min .. m_max} and protein = {n_min .. n_max}
- Return type
numpy.array
-
plot_probability_distribution
(p)[source]¶ Plot steady state
- Parameters
p (
numpy.array
) – probability of each (mRNA, protein) state (dimensionless)- Returns
figure
- Return type
matplotlib.figure.Figure
-
plot_simulation_results
(t, p)[source]¶ Plot simulation results
- Parameters
t (
numpy.array
) – simulation time (h)p (
numpy.array
) – predicted probability of each (mRNA, protein) state at each time point (dimensionless)
- Returns
figure
- Return type
matplotlib.figure.Figure
-
simulate
(t_0=0.0, t_end=100.0, t_step=1.0)[source]¶ Run the simulation
- Parameters
t_0 (
float
, optional) – initial time (h)t_end (
float
, optional) – end time (h)t_step (
float
, optional) – frequency at which to record predicted mRNA and proteins
- Returns
numpy.array
: simulation time (h)numpy.array
: predicted probability of each (mRNA, protein) state at each time point (dimensionless)
- Return type
tuple
-
-
class
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.
OdeSimulation
(k_m=5, k_n=20, gamma_m=13.862943611198906, gamma_n=0.06931471805599453, m_0=1, n_0=98)[source]¶ Bases:
object
Represents an ODE simulation of mRNA and protein synthesis and degradation
-
dm_dt
(m, n)[source]¶ Calculate the rate of change of mRNA
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
rate of change of mRNA (molecules h-1)
- Return type
float
-
dn_dt
(m, n)[source]¶ Calculate the rate of change of proteins
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
rate of change of proteins (molecules h-1)
- Return type
float
-
dx_dt
(x)[source]¶ Calculate the rate of change of the system (mRNA and proteins)
- Parameters
x (
numpy.array
) – numbers of particles (tuple of mRNA and proteins numbers) (molecules)- Returns
rate of change of the system (tuple of the rates of change of mRNA and proteins) (molecules h-1)
- Return type
float
-
get_steady_stability
(jacobian)[source]¶ Get the stability of a steady state
- Parameters
jacobian (
numpy.ndarray
) – jacobian of the model- Returns
stability of the steady state
- Return type
str
-
get_steady_state
()[source]¶ Calculate the steady state
- Returns
steady-state mRNA number (molecules)
float
: steady-state protein number (molecules)str
: stability of the steady state- Return type
float
-
jacobian
(x)[source]¶ Calculate the Jacobian of the system
- Parameters
x (
numpy.array
) – numbers of particles (tuple of mRNA and proteins numbers) (molecules)- Returns
Jacobian (h-1)
- Return type
numpy.array
-
plot_simulation_results
(t, m, n)[source]¶ Plot simulation results
- Parameters
t (
numpy.array
) – simulation time (h)m (
numpy.array
) – predicted mRNA (molecules)n (
numpy.array
) – predicted proteins (molecules)
- Returns
figure
- Return type
matplotlib.figure.Figure
-
r_m_deg
(m, n)[source]¶ Calculate the mRNA degradation rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
mRNA degradation rate (molecules h-1)
- Return type
float
-
r_m_syn
(m, n)[source]¶ Calculate the mRNA synthesis rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
mRNA synthesis rate (molecules h-1)
- Return type
float
-
r_n_deg
(m, n)[source]¶ Calculate the protein degradation rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
protein degradation rate (molecules h-1)
- Return type
float
-
r_n_syn
(m, n)[source]¶ Calculate the protein synthesis rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
protein synthesis rate (molecules h-1)
- Return type
float
-
simulate
(t_0=0.0, t_end=100.0, t_step=1.0)[source]¶ Run the simulation
- Parameters
t_0 (
float
, optional) – initial time (h)t_end (
float
, optional) – end time (h)t_step (
float
, optional) – period at which to record predicted mRNA and proteins (h)
- Returns
numpy.array
: simulation time (h)numpy.array
: predicted mRNA (molecules)numpy.array
: predicted proteins (molecules)
- Return type
tuple
-
-
class
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.
SsaSimulation
(k_m=5, k_n=20, gamma_m=13.862943611198906, gamma_n=0.06931471805599453, m_0=1, n_0=98)[source]¶ Bases:
object
Represents an SSA simulation of mRNA and protein synthesis and degradation
-
plot_average_trajectory
(t, m, n)[source]¶ Plot the average of multiple trajectories
- Parameters
t (
numpy.array
) – simulation time (h)m (
numpy.array
) – predicted mRNA (molecules)n (
numpy.array
) – predicted proteins (molecules)
- Returns
figure
- Return type
matplotlib.figure.Figure
-
plot_mrna_protein_distribution
(m, n)[source]¶ Plot the average of multiple trajectories
- Parameters
m (
numpy.array
) – predicted mRNA (molecules)n (
numpy.array
) – predicted proteins (molecules)
- Returns
figure
- Return type
matplotlib.figure.Figure
-
plot_trajectories
(t, m, n)[source]¶ Plot multiple trajectories
- Parameters
t (
numpy.array
) – simulation time (h)m (
numpy.array
) – predicted mRNA (molecules)n (
numpy.array
) – predicted proteins (molecules)
- Returns
figure
- Return type
matplotlib.figure.Figure
-
r_m_deg
(m, n)[source]¶ Calculate the mRNA degradation rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
mRNA degradation rate (molecules h-1)
- Return type
float
-
r_m_syn
(m, n)[source]¶ Calculate the mRNA synthesis rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
mRNA synthesis rate (molecules h-1)
- Return type
float
-
r_n_deg
(m, n)[source]¶ Calculate the protein degradation rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
protein degradation rate (molecules h-1)
- Return type
float
-
r_n_syn
(m, n)[source]¶ Calculate the protein synthesis rate
- Parameters
m (
float
) – mRNA number (molecules)n (
float
) – protein number (molecules)
- Returns
protein synthesis rate (molecules h-1)
- Return type
float
-
sample_initial_conditions
()[source]¶ Sample initial mRNA and protein copy numbers
- Returns
int
: initial mRNA copy numberint
: initial protein copy number
- Return type
tuple
-
simulate
(t_0=0.0, t_end=100.0, t_step=1.0)[source]¶ Run the simulation
- Parameters
t_0 (
float
, optional) – initial time (h)t_end (
float
, optional) – end time (h)t_step (
float
, optional) – frequency at which to record predicted mRNA and proteins
- Returns
numpy.array
: simulation time (h)numpy.array
: predicted mRNA (molecules)numpy.array
: predicted proteins (molecules)
- Return type
tuple
-
simulate_ensemble
(n_trajectories=50, t_0=0.0, t_end=100.0, t_step=1.0)[source]¶ Run multiple simulations
- Parameters
n_trajectories (
int
, optional) – number of simulation to runt_0 (
float
, optional) – initial time (h)t_end (
float
, optional) – end time (h)t_step (
float
, optional) – frequency at which to record predicted mRNA and proteins
- Returns
numpy.array
: simulation time (h)numpy.array
: predicted mRNA (molecules)numpy.array
: predicted proteins (molecules)
- Return type
tuple
-
-
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.
deterministic_exercise
()[source]¶
7.1.1.1.1.6. intro_to_wc_modeling.cell_modeling.simulation.ode module¶
ODE simulation tutorial
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2017-06-23
- Copyright
2017, Karr Lab
- License
MIT
-
intro_to_wc_modeling.cell_modeling.simulation.ode.
d_conc_d_t
(concs, time)[source]¶ Calculate differentials for Goldbeter 1991 cell cycle model (BIOMD0000000003)
- Parameters
time (
float
) – timeconcs (
numpy.ndarray
) – array of current concentrations
- Returns
numpy.ndarray
7.1.1.1.1.7. intro_to_wc_modeling.cell_modeling.simulation.stochastic module¶
Stochastic simulation tutorial
- Author
Jonathan Karr <jonrkarr@gmail.com>
- Date
2017-06-22
- Copyright
2017, Karr Lab
- License
MIT
-
intro_to_wc_modeling.cell_modeling.simulation.stochastic.
simulate
(reaction_stochiometries, kinetic_laws, init_copy_number, time_max, time_step)[source]¶ Run a stochastic simulation
- Parameters
reaction_stochiometries (
list
ofint
) – list of stoichiometries of the protein in each reactionkinetic_laws (
list
offunction
) – list of kinetic law functioninit_copy_number (
int
) – initial copy numbertime_max (
float
) – simulation lengthtime_step (
float
) – frequency to record predicted dynamics
- Returns
numpy.ndarray
: time pointsnumpy.ndarray
: predicted copy number at each time point
- Return type
tuple