Skip to main content

chemoREsistance SIMulator

Project description

ReSim (chemoREsistance SIMulator) is a python package that 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).

ReSim provides both GUI (powered by Flask <>) and CUI.

Remarks: Simulation result is greatly depended on input params, therefore ReSim is intended to use in parallel with in vitro assay. Procedures or details in identifying input params in vitro is out of scope here and will be documented in elsewhere (hope to get it publish soon).


  • flask
  • Flask-WTF
  • numpy
  • scipy
  • pandas
  • matplotlib
  • seaborn
  • plotly
  • sdeint


We strongly recommend everyone to install resim within a virtual environment. Setup the venv as usual and run

$ pip install resim

Otherwise, install it locally.

Getting Start - GUI

Open your command prompt, simply run

$ resim-flask

ReSim is now available at http://localhost:5000/resim .

Note GUI provides a simplified & handy version of resim with interactive plotly plots. Please use CUI if you need more control of input params.

Advanced Usage

Using defaults params (calibrated from the case of sorafenib and liver cancer):

>>> import resim

>>> model = resim.Simulator()
>>> res = model.simulate()

>>> snsplt_cells = resim.plot_cells(res, subplot=True)
>>> snsplt_drug = resim.plot_drug(res)
>>> snsplt_fht = resim.plot_fht(res)

>>> snsplt_cells.figure.savefig('resim_cells.png')
>>> snsplt_drug.figure.savefig('resim_drug.png')
>>> snsplt_fht.figure.savefig('resim_fht.png')

You may set your own params. For examples, input the growth rate of sensitive cells and resistant cells determined in vitro:

>>> import resim

>>> model = resim.Simulator(gr=[0.2, 0.1, 0.1])
>>> res = model.simulate()

model.simulate() returns a dict of dictionary containing pd.DataFrame or np.array. To extract the result,:

>>>  df_cells = res['case']['cells']
>>>  df_drugs = res['case']['drugs']

>>> l_fht_control = res['control']['fht'])
>>> l_fht_treatment = res['case']['fht'])

Notes GUI outputs are generated by Plotly <>. But both plot_cells, plot_drug and plot_fht in CUI return seaborn <> plot object. You may customize your own theme, title, layout.


Available at


  • Add class methods for conventional first-line/second-line chemos in HCC, PC.
  • Add tool for converting tumor’s diameter/volume to number of cells.
  • Add tool for converting doubling time to growth rate.
  • Add tool for converting half-life to k.
  • Add command line module.
  • Integrate parallel programming sde solver module nsim <> to speed up the computation.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for resim, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size resim-0.1.1-py2-none-any.whl (22.1 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size resim-0.1.1.tar.gz (17.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page