Plots and visualization (thunor.plots)

exception thunor.plots.CannotPlotError
thunor.plots.plot_ctrl_dip_by_plate(df_controls, title=None, subtitle=None)
Parameters:
  • df_controls (pd.DataFrame) – Control well DIP values
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_drc(fit_params, is_absolute=False, color_by=None, color_groups=None, title=None, subtitle=None)

Plot dose response curve fits

Parameters:
  • fit_params (pd.DataFrame) – Fit parameters from thunor.curve_fit.fit_params()
  • is_absolute (bool) – For DIP rate plots, use absolute (True) or relative (False) y-axis scale. Ignored for viability plots.
  • color_by (str or None) – Color the traces by cell lines if ‘cl’, drugs if ‘dr’, or arbitrarily if None (default)
  • color_groups (dict or None) – If using color_by, provide a dictionary containing the color groups, where the values are cell line or drug names
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_drc_params(df_params, fit_param, fit_param_compare=None, fit_param_sort=None, title=None, subtitle=None, aggregate_cell_lines=False, aggregate_drugs=False, multi_dataset=False, color_by=None, color_groups=None, **kwargs)

Box, bar, or scatter plots of DIP rate fit parameters

Parameters:
  • df_params (pd.DataFrame) – DIP fit parameters from thunor.dip.dip_params()
  • fit_param (str) – Fit parameter name, e.g. ‘ic50’
  • fit_param_compare (str, optional) – Second fit parameter name for comparative plots, e.g. ‘ec50’
  • fit_param_sort (str, optional) – Fit parameter name to use for sorting the x-axis, if different from fit_param
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
  • aggregate_cell_lines (bool or dict, optional) – Aggregate all cell lines (if True), or aggregate by the specified groups (dict of cell line names as values, with group labels as keys)
  • aggregate_drugs (bool or dict, optional) – Aggregate all drugs (if True), or aggregate by the specified groups (dict of drug names as values, with group labels as keys)
  • multi_dataset (bool) – Set to true to compare two datasets contained in fit_params
  • color_by (str or None) – Color by cell lines if “cl”, drugs if “dr”, or arbitrarily if None (default)
  • color_groups (dict or None) – Groups of cell lines of drugs to color by
  • kwargs (dict, optional) – Additional keyword arguments
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_drug_combination_heatmap(ctrl_resp_data, expt_resp_data, title=None, subtitle=None)

Plot heatmap of drug combination response by DIP rate

Two dimensional plot (each dimension is a drug concentration) where squares are coloured by DIP rate value.

Parameters:
  • ctrl_resp_data (pd.DataFrame) – Control DIP rates from thunor.dip.dip_rates()
  • expt_resp_data (pd.DataFrame) – Experiment (non-control) DIP rates from thunor.dip.dip_rates()
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_plate_map(plate_data, color_by='dip_rates', missing_color='lightgray', subtitle=None)
Parameters:
  • plate_data (thunor.io.PlateData) – Plate map layout data
  • color_by (str) – Attribute to color wells by, must be numerical (default: dip_rates)
  • missing_color (str) – Color to use for missing values (default: lightgray)
  • subtitle (str or None) – Subtitle, or None to auto-generate
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_time_course(hts_pandas, log_yaxis=False, assay_name='Assay', title=None, subtitle=None, show_dip_fit=False)

Plot a dose response time course

Parameters:
  • hts_pandas (HtsPandas) – Dataset containing a single cell line/drug combination
  • log_yaxis (bool) – Use log scale on y-axis
  • assay_name (str) – The name of the assay to use for the time course (only used for multi-assay datasets)
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
  • show_dip_fit (bool) – Overlay the DIP rate fit on the time course
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure

thunor.plots.plot_two_dataset_param_scatter(df_params, fit_param, title, subtitle, color_by, color_groups, **kwargs)

Plot a parameter comparison across two datasets

Parameters:
  • df_params (pd.DataFrame) – DIP fit parameters from thunor.dip.dip_params()
  • fit_param (str) – The name of the parameter to compare across datasets, e.g. ic50
  • title (str, optional) – Title (or None to auto-generate)
  • subtitle (str, optional) – Subtitle (or None to auto-generate)
  • kwargs (dict, optional) – Additional keyword arguments
Returns:

A plotly figure object containing the graph

Return type:

plotly.graph_objs.Figure