I know this is an old question, but since it had no replies and shows up in google, I wanted to answer.
I created a Python package for calculating synergy using many models on pypi and github. It implements Loewe, Bliss, HSA, MuSyC, BRAID, ZIP, Schindler's multidimensional Hill, Zimmer's effective dose model, and combination index.
Some models are parametric, while the others are dose-dependent. Here is an example of basic usage for both kinds (using MuSyC (a parametric model) and Bliss (a dose-dependent model) as examples). The data is assumed to be in a .csv spreadsheet with columns for "drug1.conc", "drug2.conc", and "effect"
import pandas as pd
from synergy.combination import MuSyC
from synergy.combination import Bliss
# Other models are available too
# Read the data
df = pd.read_csv("dataset.csv")
d1 = df['drug1.conc']
d2 = df['drug2.conc']
E = df['effect']
# Instantiate synergy model(s)
model_musyc = MuSyC()
model_bliss = Bliss()
# Calculate synergy
model_musyc.fit(d1, d2, E)
model_bliss.fit(d1, d2, E)
# Get results
print(model_musyc.get_parameters()) # MuSyC is a parametric model, so synergy is encoded in its parameters
print(model_bliss.synergy) # Bliss is dose-dependent, so synergy is an array the same size as d1, d2, or E
# Make plots
# Surface plots require plotly
model_musyc.plot_surface_plotly(d1, d2, scatter_points=df, fname="MuSyC_surface.html")
model_bliss.plot_surface_plotly(fname="Bliss_surface.pdf")
# Heatmaps require matplotlib
model_musyc.plot_heatmap(d1, d2, fname="MuSyC_heatmap.pdf")
model_bliss.plot_heatmap(fname="Bliss_heatmap.pdf")
Notes:
- Most models expect drugs to cause "effect" to decrease, such as
is the case with proliferation or viability assays
- Assays measuring percents should be on a 0 to 1 scale, not 0 to 100
- Doses should be raw (e.g., not log-transformed), though they will be
log-transformed in the plots. This can be overridden by passing the
argument
logscale=False
in plot_heatmap()
or plot_surface()
Combos of three of more drugs are supported for most models. Usage is similar, except for the following points
- Models should be imported as
from synergy.higher import MuSyC # etc...
- Doses are not separated as
d1
and d2
, but should be in a single M x N array (M is the number of samples, N is the number of drugs). So to calculate synergy you use model.fit(d, E)
Isosurface plots are supported if you have plotly installed, as model.plotly_isosurfaces()
. For parametric models, you have to pass d
as an argument, for dose-dependent models, d
is remembered from model.fit(d,E)
.
.
Hi Dwooten,
I really appreciate your help. Thank you very much for creating the python package and your explanation.
It is not clear for me how to create a drug response dataset that it passed in the fit method.
Can you give a link, article that I can understand how to create that dataset?
Thank you very much!
Hi Carlos,
There are three required arguments for
model.fit(d1, d2, E)
.d1
should be an array with all the concentrations of drug 1, and likewise ford2
.E
should be an array, with length equal to bothd1
andd2
, containing the response at those concentrations.I added an example file containing that data here: https://github.com/djwooten/synergy/blob/master/datasets/sample_data_1.csv
Each row (beyond the header) in that file corresponds to a single measurement.
Hi Dwooten,
Thank you for this elegant synergy package. I have a question. How should we treat replicates? Should we only provide the mean of multiple replicates?
Also, could you clarify: is E0_bounds the range between E0-E1 or E0-E2? I'm confused on the definition of E(0-3)_bounds and how we provide bounds to aid in fitting.
Thank you!