Thunor Core Tutorial¶
Thunor (pronounced THOO-nor) is a free software platform for managing, visualizing, and analyzing high throughput cell proliferation data, which measure the dose-dependent response of cells to one or more drug(s).
This repository, Thunor Core, is a Python package which can be used for standalone analysis or integration into computational pipelines.
A web interface is also available, called Thunor Web. Thunor Web has a comprehensive manual, which goes into further detail about the curve fitting methods, types of plots available and other information you may find relevant.
Please see the Thunor website for additional resources, and a link to our chat room, where you can ask questions about Thunor.
Start Jupyter Notebook¶
Run jupyter notebook with the following argument:
jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10
The data rate limit needs to be increased or
init_notebook_mode() throws an error. This is a plotly requirement.
Check Thunor Core is available¶
# If the import doesn't work, uncomment the following two lines, or "pip install thunor" # import os, sys # sys.path.insert(0, os.path.abspath('../')) import thunor
Load a file¶
First, specify a file to load. Here, we use an example dataset from the thunor package itself.
hts007_file = '../thunor/testdata/hts007.h5'
Load the file using
read_hdf (for HDF5 files),
read_vanderbilt_hts (for CSV files), or another appropriate reader.
from thunor.io import read_hdf hts007 = read_hdf(hts007_file)
We’ll just use a subset of the drugs, to make the plots manageable.
hts007r = hts007.filter(drugs=['cediranib', 'everolimus', 'paclitaxel'])
[('cediranib',), ('everolimus',), ('paclitaxel',)]
['BT20', 'HCC1143', 'MCF10A-HMS', 'MCF10A-VU', 'MDAMB231', 'MDAMB453', 'MDAMB468', 'SUM149']
Calculate DIP rates and parameters¶
These two operations can be done in two lines of code (plus imports). Note that you may see
RuntimeWarning messages, which indicates that some dose response curves were not able to be fitted. This can happen if the cells do not stop proliferating in response to drug, the response is not closely approximated by a log-logistic curve, or the data are very noisy.
from thunor.dip import dip_rates from thunor.curve_fit import fit_params ctrl_dip_data, expt_dip_data = dip_rates(hts007r) fp = fit_params(ctrl_dip_data, expt_dip_data)
/home/docs/checkouts/readthedocs.org/user_builds/thunor/envs/stable/lib/python3.7/site-packages/thunor-0.1.22-py3.7.egg/thunor/curve_fit.py:157: RuntimeWarning: invalid value encountered in log /home/docs/checkouts/readthedocs.org/user_builds/thunor/envs/stable/lib/python3.7/site-packages/thunor-0.1.22-py3.7.egg/thunor/curve_fit.py:225: RuntimeWarning: invalid value encountered in double_scalars
Setting up plots¶
Each of the
plot_X functions returns a plotly
Figure object which can be visualised in a number of ways. Here, we use the offline
iplot function, which generates a plot for use with Jupyter notebook. We could also generate plots using the
plot function in standalone HTML files. See the plotly documentation for more information on the latter approach.
from thunor.plots import plot_drc, plot_drc_params, plot_time_course, plot_ctrl_dip_by_plate, plot_plate_map from plotly.offline import plot, iplot, init_notebook_mode init_notebook_mode()