In [3]:
import sys
sys.path.insert(0,'..')
from notebookFunctions import *
# from .. import notebookFunctions
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import griddata
%matplotlib inline
plt.rcParams['figure.figsize'] = (10,6.180)    #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2

In [48]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/sixth/rg_0.15_lipid_1.0_mem_1_go_0.8/rerun_3_18_Apr_220421.feather")
dic = {"T0":280, "T1":300, "T2":325, "T3":350, "T4":375, "T5":400, "T6":450, "T7":500, "T8":550, "T9":600, "T10":650, "T11":700}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun1 = data
t = a.query("Temp < 400").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()


Out[48]:
<seaborn.axisgrid.FacetGrid at 0x1a2c936588>

In [49]:
rerun1["A"] = rerun1["AMH-Go"]

In [56]:
t = rerun1.query(" Qw > 0.45 and A > -410")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
print(t.shape)


(1, 44)

In [57]:
t


Out[57]:
Step Run Temp Qw Energy DisReal z_average abs_z_average z_h1 z_h2 ... Lipid9 Lipid10 Lipid11 Lipid12 Lipid13 Lipid14 Lipid15 TotalE BiasTo A
746019 38676000 3 375 0.478038 -692.262747 34.748474 -0.037852 11.082447 0.329186 -4.93307 ... 2.580536 -1.854216 2.174274 -2.029128 0.044288 -4.959348 2.430202 -692.543484 52.0 -407.35098

1 rows × 44 columns


In [59]:
t = rerun1.query(" Qw > 0.45 and z_h6 > -16 and z_h6 < -10")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
print(t.shape)


(15, 44)

In [60]:
t["Distance"]


Out[60]:
348838    41.031055
348850    33.973365
480602    37.417546
486650    41.773973
487442    42.090359
487454    38.320434
488378    41.186078
491078    36.519706
491090    34.309122
491102    30.595530
491114    27.083310
491126    32.064842
491138    33.092049
558853    36.293951
926016    37.991035
Name: Distance, dtype: float64

In [54]:
t["AMH-Go"]


Out[54]:
165231    -473.507731
171831    -483.171682
213793    -451.873859
348838    -453.404904
348850    -467.950760
424372    -453.588570
474373    -437.989229
480602    -427.928858
486650    -438.143047
487442    -434.244490
487454    -420.522364
488378    -433.536633
491078    -430.117134
491090    -438.326357
491102    -431.602940
491114    -431.398316
491126    -435.312696
491138    -447.248602
558853    -449.567060
612897    -476.819231
654374    -464.315937
852136    -475.443524
926016    -444.390752
982549    -472.395185
982561    -458.189932
1050480   -475.484297
1053792   -461.023383
Name: AMH-Go, dtype: float64

In [61]:
t.to_csv("/Users/weilu/Research/server/rerun3.csv")

In [32]:
t["z_h6"]


Out[32]:
169687   -17.936083
413047   -16.123231
416959   -16.998263
632226   -17.293526
634746   -15.142301
647826   -17.857342
Name: z_h6, dtype: float64

In [35]:
t = rerun1.query("Qw > 0.45 and Qw < 0.6 and z_h6 > -18 and z_h6 < -8")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
print(t.shape)


(23, 44)

In [33]:
t["DisReal"]


Out[33]:
169687    66.009238
413047    81.495232
416959    87.025257
632226    66.216646
634746    69.605130
647826    72.183324
Name: DisReal, dtype: float64

In [15]:
t["AMH-Go"]


Out[15]:
126651    -434.812468
127335    -435.337225
131595    -430.404867
131607    -438.401044
131619    -436.677166
131631    -438.187377
131667    -441.371798
131679    -439.961290
132303    -443.646994
169961    -460.434225
176417    -459.414029
393403    -439.663604
552680    -433.854146
600381    -434.327205
606021    -422.882388
606033    -443.030481
948848    -457.519832
949964    -452.763558
986017    -452.229263
1072632   -416.370541
1072944   -437.246998
1072968   -440.831191
1074372   -464.437889
Name: AMH-Go, dtype: float64

In [11]:
t.to_csv("/Users/weilu/Research/server/barrier.csv")

force is 0.2, which is 13pN.


In [133]:
pre = "/Users/weilu/Research/server/mar_2018/04_week"
temp = 260
location = pre + "/sixth_with_real_distance_2/_280-350/2d_z_qw/without_subsample_force_0.2/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 14), end=(28,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x108194da0>
Out[133]:
[<matplotlib.lines.Line2D at 0x1a19a9a4e0>]

In [170]:
from scipy.interpolate import CubicSpline
x = np.array(range(len(f)))
x_smooth1 = np.linspace(x.min(), x.max(), 200)
spl1 = scipy.interpolate.interp1d(x, f, kind="cubic")
plt.ylabel("FreeEnergy (kT)")
plt.plot(x_smooth1, spl1(x_smooth1))

plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/smoothed_shortest_path.png")



In [129]:
f_on_path
x = np.array(range(len(f_on_path)))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_on_path, kind="cubic")
plt.plot(x_smooth, spl(x_smooth))
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/smoothed_shortest_path_expected_dis.png")



In [162]:
pre = "/Users/weilu/Research/server/mar_2018/04_week"
temp = 260
location = pre + "/sixth_with_real_distance_2/_280-350/2d_z_qw/without_subsample_force_0.2/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 14), end=(28,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x108194da0>
Out[162]:
[<matplotlib.lines.Line2D at 0x1a1dd1a4a8>]

In [171]:
from scipy.interpolate import CubicSpline
x = np.array(range(len(f)))
spl1 = scipy.interpolate.interp1d(x, f, kind="cubic")
# plt.plot(x_smooth1, spl1(x_smooth1))
f_on_path
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_on_path, kind="cubic")
# plt.plot(x_smooth, spl(x_smooth))
# Create axes
fig, ax = plt.subplots()
ax1, ax2 = two_scales(ax, x_smooth, spl1(x_smooth), spl(x_smooth), 'r', 'b')

color_y_axis(ax1, 'r')
color_y_axis(ax2, 'b')
# plt.show()
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/freeEnergy_Distance.png")



In [167]:
plt.scatter(f_on_path, f)


Out[167]:
<matplotlib.collections.PathCollection at 0x1a20ea5a58>

In [165]:
xi.shape


Out[165]:
(30,)

In [159]:
pre = "/Users/weilu/Research/server/mar_2018/04_week"
temp = 260
res = 35
location = pre + "/sixth_with_real_distance_2/_280-350/2d_z_qw/without_subsample_force_0.2/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 10), end=(30,30), save=False, xlabel="z_H6", ylabel="Qw",res=res)
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100, res=res)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x108194da0>
Out[159]:
[<matplotlib.lines.Line2D at 0x1a1f12c5c0>]

In [153]:
from scipy.interpolate import CubicSpline
x = np.array(range(len(f)))
spl1 = scipy.interpolate.interp1d(x, f, kind="cubic")
# plt.plot(x_smooth1, spl1(x_smooth1))
f_on_path
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_on_path, kind="cubic")
# plt.plot(x_smooth, spl(x_smooth))
# Create axes
fig, ax = plt.subplots()
ax1, ax2 = two_scales(ax, x_smooth, spl1(x_smooth), spl(x_smooth), 'r', 'b')

color_y_axis(ax1, 'r')
color_y_axis(ax2, 'b')
plt.show()



In [139]:
plt.plot(x_smooth1, spl(x_smooth1), x_smooth, spl(x_smooth))


Out[139]:
[<matplotlib.lines.Line2D at 0x1a1ae90278>]

In [126]:
plt.scatter(np.array(f_on_path)-35, f)


Out[126]:
<matplotlib.collections.PathCollection at 0x1a24d4b2e8>

In [97]:
pre = "/Users/weilu/Research/server/mar_2018/04_week"
temp = 260
location = pre + "/sixth_with_real_distance_2/_280-350/2d_z_qw/without_subsample_force_0.2/"
location2 = location + f"pmf-{temp}.dat"
# path, f = shortest_path(location2, start=(1, 14), end=(28,24), plot1d=True, save=False)
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x108194da0>
Out[97]:
[<matplotlib.lines.Line2D at 0x1a25373470>]

In [45]:
pre = "/Users/weilu/Research/server/mar_2018/04_week"
temp = 260
location = pre + "/sixth_with_real_distance_2/_280-350/2d_z_qw/without_subsample_force_0.2/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 14), end=(28,24), plot1d=True, save=False)
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x108194da0>
Out[45]:
[<matplotlib.lines.Line2D at 0x1a19c48c88>]