7.1.1.1.1. intro_to_wc_modeling.cell_modeling.simulation package

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 of str, function) – dictionary of regulatory functions for each species

  • step (int) – step iteration

  • current_state (dict of str, bool) – dictionary of values of each species

Returns

dictionary of values of each species

Return type

dict of str, bool

intro_to_wc_modeling.cell_modeling.simulation.boolean.main()[source]
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 of str, function) – dictionary of regulatory functions for each species

  • step (int) – step iteration

  • current_state (dict of str, bool) – dictionary of values of each species

Returns

dictionary of values of each species

Return type

dict of str, 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 using update_scheme

Parameters
  • regulatory_functions (dict of str, function) – dictionary of regulatory lambda functions for each species

  • initial_state (dict of str, bool) – dictionary of initial values of each species

  • n_steps (int) – number of steps to simulate

  • update_scheme (method) – update schema

Returns

  • numpy.ndarray: array of step numbers

  • dict of str, 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 of str, function) – dictionary of regulatory functions for each species

  • step (int) – step iteration

  • current_state (dict of str, bool) – dictionary of values of each species

Returns

dictionary of values of each species

Return type

dict of str, 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

intro_to_wc_modeling.cell_modeling.simulation.dfba.main(init_concs=None)[source]

Run dFBA simsulation, plot results, and save plots

Parameters

init_concs (dict, optional) – initial concentrations

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

k_m[source]

mRNA synthesis rate constant (molecules h-1)

Type

float

k_n[source]

protein synthesis rate constant (-1 h-1)

Type

float

gamma_m[source]

mRNA degradation rate constant (h-1)

Type

float

gamma_n[source]

protein degradation rate constant (h-1)

Type

float

m_min[source]

minimum mRNA copy number to simulate

Type

int

m_max[source]

maximum protein copy number to simulate

Type

int

n_min[source]

minimum mRNA copy number to simulate

Type

int

n_max[source]

maximum protein copy number to simulate

Type

int

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

k_m[source]

mRNA synthesis rate constant (molecules h-1)

Type

float

k_n[source]

protein synthesis rate constant (-1 h-1)

Type

float

gamma_m[source]

mRNA degradation rate constant (h-1)

Type

float

gamma_n[source]

protein degradation rate constant (h-1)

Type

float

m_0[source]

initial mRNA number (molecules)

Type

float

n_0[source]

initial protein number (molecules)

Type

float

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

plot_vector_field()[source]

Plot vector field

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

x(m, n)[source]

Generate a vector of species numbers

Parameters
  • m (float) – mRNA number (molecules)

  • n (float) – protein number (molecules)

Returns

numbers of particles (tuple of mRNA and proteins numbers) (molecules)

Return type

numpy.array

property x_0[source]
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

k_m[source]

mRNA synthesis rate constant (molecules h-1)

Type

float

k_n[source]

protein synthesis rate constant (-1 h-1)

Type

float

gamma_m[source]

mRNA degradation rate constant (h-1)

Type

float

gamma_n[source]

protein degradation rate constant (h-1)

Type

float

m_0[source]

initial mRNA number (molecules)

Type

float

n_0[source]

initial protein number (molecules)

Type

float

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 number

  • int: 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 run

  • 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

intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.deterministic_exercise()[source]
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.probability_distribution_exercise()[source]
intro_to_wc_modeling.cell_modeling.simulation.mrna_and_proteins_using_several_methods.trajectory_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) – time

  • concs (numpy.ndarray) – array of current concentrations

Returns

numpy.ndarray

intro_to_wc_modeling.cell_modeling.simulation.ode.main()[source]

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.kinetic_laws(copy_number)[source]
intro_to_wc_modeling.cell_modeling.simulation.stochastic.main()[source]
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 of int) – list of stoichiometries of the protein in each reaction

  • kinetic_laws (list of function) – list of kinetic law function

  • init_copy_number (int) – initial copy number

  • time_max (float) – simulation length

  • time_step (float) – frequency to record predicted dynamics

Returns

  • numpy.ndarray: time points

  • numpy.ndarray: predicted copy number at each time point

Return type

tuple

7.1.1.1.1.8. Module contents