resim package

Submodules

resim.command_line module

ReSim - entry point

resim.command_line.run_resim_flask()

run resim flask from command prompt

resim.core module

ReSim: chemoREsistance SIMulator

ReSim (chemoREsistance SIMulator) simulates cancer chemoresistance dynamics based on a stochastic model. The model describes the interaction between chemotherapeutics and various cancer cell subpopulations (including sensitive, primary resistant, acquired resistant and quiescent cancer cells).

Examples

minimal setup using default parameters:
>>>  import resim
>>>  model = resim.Simulator()
>>>  res = model.simulate()
set your own params:
>>>  model = resim.Simulator(gr=[0.02, 0.1, 0.1])
or
>>>  model = resim.Simulator()
>>>  model.set_param_gr([0.02, 0.1, 0.1])
or
>>>  model = resim.Simulator()
>>>  model.gr_s = 0.02
>>>  model.gr_pr = 0.1

Please set t using set_param_t instead of assign directly to model.t.

Attribute:
sig (int): calibrated diffusion constant for the set of stochastic differential equations. ccmax (float): tumor carrying capacity (10^8).
class resim.core.Simulator(gr=[0.015, 0.015, 0.015], k=[1e-06, 0.0001, 0.0005, 1e-06, 0.0005, 1e-06, 0.0005, 0.0005, 0.0005, 0.0005], d=[10, 10, 240, 0.9, 0.7], init=[0.42, 0.05, 0, 0.03, 0], t=365, n=50)

ReSim Simulator Class

set_param_d(d)

Set drug related parameters

Parameters:

d (list of floats) – drug related constants (ki, qf, dose, dsmax, ke).

Raises:
  • ValueError – if d length not equal to 5.
  • ValueError – if any elements in d smaller than 0.
set_param_gr(gr)

Set growth rates

Parameters:

gr (list of floats) – growth rate of cancer cells (gr_s, gr_pr, gr_ar).

Raises:
  • ValueError – if gr length not equal to 3.
  • ValueError – if any elements in gr smaller than 0.
set_param_k(k)

Set k

Parameters:

k (list of floats) – kinetic constants (ks_pr, ks_ar, ks_q, kpr_s, kpr_q, kar_s, kar_q, kq_s, kq_pr, kq_ar).

Raises:
  • ValueError – if k length not equal to 10.
  • ValueError – if any elements in k smaller than 0.
set_param_t(t)

Set t

set self.t (int) and self._tspan (numpy array).

Parameters:t (int) – simulation time frame in days e.g. 365d = 1y.
Raises:ValueError – if t is smaller than 0.
simulate()

Simulate based on Simulator attributes

Returns:dict of dictionaries with keys ‘control’ and ‘case’. Both ‘control’ and ‘case’ holds a dictionary of pandas data frame with keys ‘cells’, ‘drugs’ and ‘fht’.
Return type:dict

resim.plot module

ReSim - Plotting Module

Visualize resim result.

Examples

Available functions:
>>> snsplt_cells = resim.plot_cells(res)
>>> snsplt_drug = resim.plot_drug(res)
>>> snsplt_fht = resim.plot_fht(res)
You may save the plots in png.
>>> snsplt_cells.figure.savefig('resim_cells.png')
>>> snsplt_drug.figure.savefig('resim_drug.png')
>>> snsplt_fht.figure.savefig('resim_fht.png')
resim.plot.plot_cells(res, subplot=False)

Plot cells

Parameters:
  • res (dict) – dict return by .simulate().
  • subplot (bool) – Default is False. True to plot different type of cells
  • different plot. (in) –
Returns:

seaborn plot object

resim.plot.plot_drug(res)

Plot Drug Dynamics

Parameters:res (dict) – dict return by .simulate().
Returns:seaborn plot object
resim.plot.plot_fht(res)

Plot first hitting time (progression free survival)

Parameters:res (dict) – dict return by .simulate().
Returns:seaborn plot object

Module contents