Thunor Core Tutorial

Thunor (pronounced THOO-nor) is a free software platform to manage, visualise, and analyse 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.

Load a file

First, load the example dataset bundled with the package. hts007 is a DIP rate screen of 27 drugs on 8 breast cancer cell lines, with cell count measurements taken roughly every 6–8 hours over approximately 5 days.

For your own data, use read_hdf for HDF5 files or read_vanderbilt_hts for plain-text files.

[1]:
import importlib.resources
from thunor.io import read_hdf

with importlib.resources.as_file(
    importlib.resources.files('thunor') / 'testdata/hts007.h5'
) as hts007_path:
    hts007 = read_hdf(hts007_path)

We’ll just use a subset of the drugs, to make the plots manageable.

[2]:
hts007r = hts007.filter(drugs=['cediranib', 'everolimus', 'paclitaxel'])
[3]:
hts007r.drugs
[3]:
[('cediranib',), ('everolimus',), ('paclitaxel',)]
[4]:
hts007r.cell_lines
[4]:
['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).

[5]:
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)

Setting up plots

Each of the plot_X functions returns a plotly Figure object. When displayed in a notebook or on this documentation page, plots are rendered interactively. To save a plot as a standalone HTML file, use plotly.io.write_html; see the plotly documentation for details.

[6]:
from thunor.plots import (
    plot_drc,
    plot_drc_params,
    plot_time_course,
    plot_ctrl_dip_by_plate,
    plot_plate_map,
)
[7]:
import plotly.io as pio

# Use the notebook_connected renderer so plots display correctly in
# both Jupyter and on the documentation pages (nbsphinx).
pio.renderers.default = 'notebook_connected'

Plot Types

Plot DIP rate curves

[8]:
plot_drc(fp)

Plot DIP parameters

[9]:
plot_drc_params(fp, 'auc')

Filtering fit params

The fp object is a pandas data frame, so we can filter it before plotting. Some examples:

[10]:
fit_params_bt20_pac = fp[
    fp.index.isin(['BT20'], level='cell_line')
    & fp.index.isin(['paclitaxel'], level='drug')
]

plot_drc(fit_params_bt20_pac)

Plot time course

Time course plot for paclitaxel on BT20 cells:

[11]:
plot_time_course(hts007.filter(drugs=['paclitaxel'], cell_lines=['BT20']))

Quality control check: plot DIP rate ranges by cell line and plate (box plot)

[12]:
plot_ctrl_dip_by_plate(ctrl_dip_data)

Quality control check: plot DIP rate as a plate heat map

[13]:
plate_data = hts007.plate('HTS007_149-28A', include_dip_rates=True)
[14]:
plot_plate_map(plate_data, color_by='dip_rates')

Viability analysis

For single-timepoint assays (e.g. 72-hour viability), use viability instead of dip_rates. The curve fitting and plotting workflow is the same, but uses a three-parameter Hill curve (HillCurveLL3u) rather than the four-parameter DIP rate model.

[15]:
from thunor.viability import viability
from thunor.curve_fit import HillCurveLL3u

viability_data, _ = viability(hts007r, include_controls=False)
vp = fit_params(ctrl_data=None, expt_data=viability_data, fit_cls=HillCurveLL3u)
[16]:
plot_drc(vp)