In [1]:
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
import fileinput
from itertools import product
import pandas as pd
from scipy.interpolate import griddata
from scipy.interpolate import interp2d
import seaborn as sns
from os import listdir
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import griddata
import matplotlib as mpl
sys.path.insert(0,'..')
from notebookFunctions import *
# from .. import notebookFunctions
%matplotlib inline
plt.rcParams['figure.figsize'] = (10,6.180) #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2
In [350]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/same_temp/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [353]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/same_temp_no_force/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [354]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/same_temp/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [355]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/same_temp_no_force/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [363]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [364]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [365]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [367]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"perturbation-3-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [368]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"perturbation-4-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [ ]:
In [ ]:
In [ ]:
In [369]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0_no_ss/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [372]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0_no_ss/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [ ]:
In [ ]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 373
location = pre + "how_force_bias_added_4/_280-350/2d_zAverage_dis/force_0.0_no_ss/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [ ]:
In [ ]:
In [351]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 370
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [ ]:
In [ ]:
In [ ]:
In [263]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy"
temp = 370
location = pre + "/second_half/_280-350/2d_zAverage_dis/force_0.1/"
location1 = location + f"perturbation-1-pmf-{temp}.dat"
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy"
temp = 370
location = pre + "/first_half/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
plot2d_side_by_side(location1, location2, xlabel="Distance", ylabel="AverageZ", title1="first", title2="second")
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/convergence_2d.png")
In [344]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 330
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin, _ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=1, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [342]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin, _ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=1, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [347]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/"
temp = 370
location = pre + "combined_more_force/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin,_ = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=0, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.xlim([20,280])
# plt.ylim([-25,10])
In [266]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=0, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.xlim([20,280])
plt.ylim([-25,10])
Out[266]:
In [269]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy"
temp = 370
location = pre + "/second_half/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin_second, f_origin_second = shortest_path_2(location2, start=(16, 30), end=(26,0), title="second_half_AverageZ_Dis",save=False, plot1d=0, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.xlim([20,280])
plt.ylim([-25,10])
Out[269]:
In [271]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy"
temp = 370
location = pre + "/first_half/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-1-pmf-{temp}.dat"
zmax=25
res=40
path_origin_first, f_origin_first = shortest_path_2(location2, start=(22, 30), end=(33,0), title="first_half_AverageZ_Dis",save=False, plot1d=0, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.xlim([20,280])
plt.ylim([-25,10])
Out[271]:
In [273]:
len(f_origin_second)
Out[273]:
In [274]:
len(f_origin_first)
Out[274]:
In [275]:
len(f_origin)
Out[275]:
In [283]:
x_on_path = np.array(path_origin)
d = pd.DataFrame(data={"x":x_on_path, "y":f_origin})
# mean the dupliation
d = d.groupby("x").mean().reset_index().values
x_smooth = np.linspace(d[:,0].min(), d[:,0].max(), 200)
spl = scipy.interpolate.interp1d(d[:,0], d[:,1], kind="cubic")
In [284]:
x_on_path = np.array(path_origin_first)
d = pd.DataFrame(data={"x":x_on_path, "y":f_origin_first})
# mean the dupliation
d = d.groupby("x").mean().reset_index().values
x_smooth_first = np.linspace(d[:,0].min(), d[:,0].max(), 200)
spl_first = scipy.interpolate.interp1d(d[:,0], d[:,1], kind="cubic")
In [285]:
x_on_path = np.array(path_origin_second)
d = pd.DataFrame(data={"x":x_on_path, "y":f_origin_second})
# mean the dupliation
d = d.groupby("x").mean().reset_index().values
x_smooth_second = np.linspace(d[:,0].min(), d[:,0].max(), 200)
spl_second = scipy.interpolate.interp1d(d[:,0], d[:,1], kind="cubic")
In [287]:
plt.plot(x_smooth, spl(x_smooth), label="combined")
plt.plot(x_smooth_first, spl_first(x_smooth_first), label="first")
plt.plot(x_smooth_second, spl_second(x_smooth_second), label="second")
plt.legend()
plt.ylim(0,20)
plt.xlabel("End to end distance(Å)")
plt.ylabel("Free energy(kT)")
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/convergence_1d.png")
In [276]:
plt.plot(x_smooth, spl(x_smooth), label="combined")
plt.plot(x_smooth, spl_first(x_smooth), label="first")
plt.plot(x_smooth, spl_second(x_smooth), label="second")
plt.legend()
plt.ylim(0,20)
plt.xlabel("End to end distance(Å)")
plt.ylabel("Free energy(kT)")
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/convergence_1d.png")
In [335]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 330
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [150]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [3]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 390
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.0/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [4]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 360
location = pre + "/combined/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"pmf-{temp}.dat"
zmax=40
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [290]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/56_z_dis/force_0.1/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(35,20), end=(3, 30),save=False, xlabel="Z_h56", ylabel="Dis56", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [11]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/56_z_dis/force_0.1/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(35,20), end=(3, 30),save=False, xlabel="Z_h56", ylabel="Dis56", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [ ]:
"/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/combined_more_force_fix_order/_280-350/56_z_dis/force_0.1/"
In [325]:
pre = "/Users/weilu/Research/server/aug_2018/02_week/freeEnergy"
temp = 370
location = pre + "/combined_more_force_fix_order/_280-350/56_z_dis/force_0.1/"
location1 = location + f"perturbation-1-pmf-{temp}.dat"
temp = 340
location = pre + "/combined_more_force_fix_order/_280-350/56_z_dis/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
plot2d_side_by_side(location1, location2, xlabel="D_h56", ylabel="Z_h56", title1="with perturbation", title2="without perturbation")
# plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/56_2d_compare.png")
In [331]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/combined/_280-350/56_z_dis/force_0.1/"
location1 = location + f"perturbation-2-pmf-{temp}.dat"
temp = 340
location = pre + "/combined/_280-350/56_z_dis/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
plot2d_side_by_side(location1, location2, xlabel="D_h56", ylabel="Z_h56", title1="with perturbation", title2="without perturbation")
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/56_2d_compare.png")
In [333]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 340
location = pre + "/combined/_280-350/56_z_dis/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin_2, f_origin_2 = shortest_path_2(location2, start=(35,20), end=(3, 30),save=False, xlabel="Z_h56", ylabel="Dis56", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [311]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 370
location = pre + "/combined/_280-350/56_z_dis/force_0.1/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(33,20), end=(3, 30),save=False, xlabel="Z_h56", ylabel="Dis56", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [317]:
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="with perturbation")
spl_2 = scipy.interpolate.interp1d(x, f_origin_2, kind="cubic")
plt.plot(x_smooth, spl_2(x_smooth), label="without perturbation")
plt.legend()
plt.ylabel("Free energy(kT)")
plt.savefig("/Users/weilu/Dropbox/GlpG_paper_2018/figures/56_1d_compare")
In [306]:
len(f_origin_2)
Out[306]:
In [312]:
len(f_origin)
Out[312]:
In [302]:
plt.plot(f_origin_2)
plt.plot(f_origin)
Out[302]:
In [15]:
pre = "/Users/weilu/Research/server/aug_2018/01_week/freeEnergy"
temp = 340
location = pre + "/combined/_280-350/56_z_dis/force_0.0/"
location2 = location + f"pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(35,20), end=(3, 30),save=False, xlabel="Z_h56", ylabel="Dis56", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [2]:
data = pd.read_feather("/Users/weilu/Research/server/aug_2018/01_week/freeEnergy/all_data_folder/second_start_extended_combined_may19.feather")
In [21]:
data.query("TempT != 417 and DisReal > 50 \
and DisReal < 63 and z_average < -2.5 and z_average > -3.5").\
query("Lipid1 < -0.5 and Lipid7 < -0.5").hist("TotalE",bins=50)
Out[21]:
In [5]:
a.columns
Out[5]:
In [61]:
data.query("TempT == 373 and BiasTo <= 110 and Step > 7e7")
Out[61]:
In [60]:
data.query("TempT == 373 and BiasTo <= 110 and Step <= 7e7")
Out[60]:
In [65]:
part1 = pd.concat([data.query("BiasTo <= 110 and Step > 7e7"),data.query("BiasTo > 110 and Step > 5.5e7")])
In [66]:
part2 = pd.concat([data.query("BiasTo <= 110 and Step <= 7e7"),data.query("BiasTo > 110 and Step <= 5.5e7")])
In [121]:
part1.reset_index(drop=True).to_feather("/Users/weilu/Research/server/aug_2018/01_week/freeEnergy/all_data_folder/part1.feather")
In [122]:
part2.reset_index(drop=True).to_feather("/Users/weilu/Research/server/aug_2018/01_week/freeEnergy/all_data_folder/part2.feather")
In [98]:
data_topology = pd.read_feather("/Volumes/Wei_backup/GlpG/may_2018_back/03_week/all_data_folder/second_start_topologyrerun_5_20_May_231514.feather")
In [101]:
data_topology_pre = pd.read_feather("/Volumes/Wei_backup/GlpG/may_2018_back/03_week/all_data_folder/second_toplogy_may21.feather")
In [99]:
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
data_topology["TempT"] = data_topology["Temp"].apply(lambda x: dic[x])
data_topology["BiasTo"] = data_topology["BiasTo"].apply(pd.to_numeric)
In [102]:
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
data_topology_pre["TempT"] = data_topology_pre["Temp"].apply(lambda x: dic[x])
data_topology_pre["BiasTo"] = data_topology_pre["BiasTo"].apply(pd.to_numeric)
In [97]:
data["Step"].hist()
Out[97]:
In [117]:
np.linspace(100, 340, 41)
Out[117]:
In [111]:
data_topology_all = pd.concat([data_topology, data_topology_pre])
In [103]:
data_topology_pre["Step"].hist()
Out[103]:
In [100]:
data_topology["Step"].hist()
Out[100]:
In [95]:
data_topology.query("TempT == 335").plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[95]:
In [86]:
part1.query("TempT == 335").plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[86]:
In [87]:
part2.query("TempT == 335").plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[87]:
In [84]:
part1.query("TempT == 373").plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[84]:
In [85]:
part2.query("TempT == 373").plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[85]:
In [62]:
data.query("TempT == 373 and BiasTo <= 110 and Step <= 7e7").plot.hexbin("z_average", "DisReal", cmap="seismic", sharex=False)
Out[62]:
In [ ]:
data.query("TempT == 373 and BiasTo < ").plot.hexbin("z_average", "DisReal", cmap="seismic", sharex=False)
In [24]:
data.query("TempT == 373").plot.hexbin("z_average", "DisReal", cmap="seismic", sharex=False)
Out[24]:
In [ ]:
data.plot.hexbin("Qw", "BiasedEnergy", cmap="seismic", sharex=False)
In [20]:
data.plot.hexbin("Qw", "BiasedEnergy", cmap="seismic", sharex=False)
Out[20]:
In [13]:
perturbation_table = {3:"Decrease Go",
4:"Increase Go",
5:"Decrease Lipid",
6:"Increase Lipid",
7:"Decrease Membrane",
8:"Increase Membrane",
9:"Decrease Rg",
10:"Increase Rg"}
all_f = {}
all_location = {}
for i in perturbation_table:
# print(i,perturbation_table[i])
location_i = location + f"perturbation-{i}-pmf-{temp}.dat"
path, f = plot_shortest_path(location_i, path_origin, save=False,
xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res,
xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, plot2d=False)
# all_path[i] = path_origin
all_f[i] = f
all_location[i] = location_i
In [14]:
i = 3
j = 4
title = "Go"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
In [15]:
i = 5
j = 6
title = "Lipid"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
# plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
In [16]:
i = 7
j = 8
title = "Membrane"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
# plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
In [17]:
i = 9
j = 10
title = "Rg"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
# plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
In [148]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/higer_force_0.2/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(11, 36), end=(26,0),save=False, plot1d=2, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [149]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(28,0),save=False, plot1d=2,xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [67]:
data = np.loadtxt(location2)
zmin = 0
z =3
xi, yi, zi = getxyz(data, zmin=zmin, zmax=zmax,res=res, z=z)
# V = ma.masked_array(zi, zi>40)
# zi = np.where(np.isnan(zi), 1e6, zi)
f_on_path = [zi[tuple(p)] for p in reversed(path_origin)]
distance_on_path = [xi[tuple(p)[1]] for p in reversed(path_origin)]
distance_on_path = np.array(distance_on_path)
x = np.arange(len(distance_on_path))
x_smooth = np.linspace(distance_on_path.min(), distance_on_path.max(), 200)
spl1 = scipy.interpolate.interp1d(distance_on_path, f_origin, kind="cubic")
plt.plot(x_smooth, spl1(x_smooth))
plt.xlabel("End to end distance(Å)")
plt.ylabel("Free energy(kT)")
# plt.ylim([0,20])
plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/freeEnergy_Distance.png")
In [14]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.18/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(10, 35), end=(28,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [15]:
perturbation_table = {3:"Decrease 10% Lipid",
4:"Increase 10% Lipid",
5:"Decrease 20% Lipid",
6:"Increase 20% Lipid",
7:"Decrease Membrane",
8:"Increase Membrane",
9:"Decrease Rg",
10:"Increase Rg"}
all_f = {}
all_location = {}
for i in perturbation_table:
# print(i,perturbation_table[i])
location_i = location + f"perturbation-{i}-pmf-{temp}.dat"
path, f = plot_shortest_path(location_i, path_origin, save=False,
xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res,
xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, plot2d=False)
# all_path[i] = path_origin
all_f[i] = f
all_location[i] = location_i
In [16]:
i = 3
j = 4
title = "Lipid"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
Out[16]:
In [17]:
i = 5
j = 6
title = "Lipid"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
Out[17]:
In [18]:
i = 7
j = 8
title = "Membrane"
plot2d_side_by_side(all_location[i], all_location[j], title1=perturbation_table[i], title2=perturbation_table[j])
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_compare.png", dpi=300)
plt.figure()
x = np.arange(len(f_origin))
x_smooth = np.linspace(x.min(), x.max(), 200)
spl = scipy.interpolate.interp1d(x, f_origin, kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label="original")
spl = scipy.interpolate.interp1d(x, all_f[i], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[i])
spl = scipy.interpolate.interp1d(x, all_f[j], kind="cubic")
plt.plot(x_smooth, spl(x_smooth), label=perturbation_table[j])
plt.ylim([0,20.5])
plt.legend(prop={'size': 20})
# plt.savefig(f"/Users/weilu/Dropbox/GlpG_paper_2018/figures/{title}_1d.png", dpi=300)
Out[18]:
In [128]:
data = pd.read_feather("/Volumes/Wei_backup/GlpG/may_2018_back/03_week/all_data_folder/secondrerun_7_19_May_155517.feather")
In [131]:
data.columns
Out[131]:
In [132]:
data_all = pd.read_feather("/Volumes/Wei_backup/GlpG/may_2018_back/03_week/all_data_folder/second_start_extended_combined_may19.feather")
In [138]:
data_all.query("Step > 7e7")
Out[138]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: