示例#1
0
def test_parametric_model_heatmap_replicates():
    from synergy.utils.dose_tools import grid
    from synergy.combination import MuSyC

    d1, d2 = grid(0.01, 10, 0.01, 10, 5, 5, include_zero=True, replicates=3)
    model = MuSyC(E0=1,
                  E1=0.2,
                  E2=0.5,
                  E3=0.1,
                  h1=1.4,
                  h2=0.9,
                  C1=0.2,
                  C2=0.2,
                  alpha12=2,
                  alpha21=0.5,
                  gamma12=1,
                  gamma21=1)
    model.plot_heatmap(d1, d2, fname="parametric.pdf")
    assert 1 == 1
示例#2
0
D1, D2 = grid(1e-3, 1, 1e-2, 10, npoints, npoints)

E = model.E(D1, D2)
E_2 = model2.E(D1, D2)

schindler = Schindler()
schindler2 = Schindler()

schindler.fit(D1, D2, E, drug1_model=drug1, drug2_model=drug2)
schindler2.fit(D1, D2, E_2, drug1_model=drug1, drug2_model=drug2)

fig = plt.figure(figsize=(7, 6))

ax = fig.add_subplot(2, 2, 1)
model.plot_heatmap(D1, D2, ax=ax, title="Dose Surface", vmin=E3, vmax=E0)
ax.set_xticks([])

ax = fig.add_subplot(2, 2, 2)
schindler.plot_heatmap(ax=ax, title="Schindler", vmin=-0.01, vmax=0.01)
ax.set_xticks([])
ax.set_yticks([])

ax = fig.add_subplot(2, 2, 3)
model2.plot_heatmap(D1, D2, ax=ax, title="Dose Surface", vmin=E3, Vmax=E0)

ax = fig.add_subplot(2, 2, 4)
schindler2.plot_heatmap(ax=ax, title="Schindler", center_on_zero=True)
ax.set_yticks([])

plt.tight_layout()
示例#3
0
#Efit = E*(1+(np.random.rand(len(D1))-0.5)/10.)
Efit = E

# Output data to test in synergyfinder R package
df = to_synergyfinder(D1, D2, Efit * 100)
df.to_csv("synergyfinder_comparison/zip_test_data.csv", index=None)

synergy = model.fit(D1, D2, Efit, use_jacobian=True)

print(model.drug1_model, model.drug2_model)

fig = plt.figure(figsize=(7, 3))

ax = fig.add_subplot(121)
musyc.plot_heatmap(D1, D2, ax=ax, title="Data")

ax = fig.add_subplot(122)
model.plot_heatmap(ax=ax, title="ZIP")

plt.tight_layout()
plt.show()

if False:
    sfdf = pd.read_csv("synergyfinder_comparison/synergyfinder_output.csv",
                       index_col=0)
    sfdf.sort_values(by=["d2", "d1"], inplace=True)

    print("Correlation between this package and synergyfinder = %f" %
          np.corrcoef(model.synergy, sfdf['synergy'])[0, 1])
    fig = plt.figure(figsize=(4, 4))
示例#4
0
                          drug2_model=loewe.drug2_model)

bliss = Bliss()
bsynergy = bliss.fit(d1,
                     d2,
                     E,
                     drug1_model=loewe.drug1_model,
                     drug2_model=loewe.drug2_model)

musyc = MuSyC()
musyc.fit(d1, d2, E)

fig = plt.figure(figsize=(12, 3))

ax = fig.add_subplot(1, 4, 1)
musyc.plot_heatmap(d1, d2, ax=ax, logscale=False, title="Sham Surface")

ax = fig.add_subplot(1, 4, 2)
loewe.plot_heatmap(ax=ax,
                   title="-log(Loewe)",
                   vmin=-0.01,
                   vmax=0.01,
                   logscale=False,
                   neglog=True)
ax.set_yticks([])

ax = fig.add_subplot(1, 4, 3)
schindler.plot_heatmap(ax=ax,
                       title="Schindler",
                       vmin=-0.01,
                       vmax=0.01,
示例#5
0
# 21.5 ms ± 422 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 29.6 ms ± 101 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 30.3 ms ± 284 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 20 ms ± 137 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 25.2 ms ± 343 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
# 25.8 ms ± 302 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
#%timeit model.fit(D1, D2, Efit, use_jacobian=False)

print(model)

fig = plt.figure(figsize=(7, 7))

ax = fig.add_subplot(221)
plots.plot_heatmap(D1, D2, E, ax=ax, title="True", cmap="viridis")

ax = fig.add_subplot(222)
plots.plot_heatmap(D1, D2, Efit, ax=ax, title="Noisy", cmap="viridis")

ax = fig.add_subplot(223)
model.plot_heatmap(D1, D2, ax=ax, title="Fit")

ax = fig.add_subplot(224)
model.plot_residual_heatmap(D1,
                            D2,
                            Efit,
                            ax=ax,
                            title="Residuals",
                            center_on_zero=True)

plt.tight_layout()
plt.show()