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 [2]:
data = pd.read_feather("/Users/weilu/Research/server/aug_2018/02_week/freeEnergy/all_data_folder/second_start_extended_combined_may19.feather")
data = data.reset_index(drop=True)
# data["BiasedEnergy"] = data["TotalE"] + 0.2*data["AMH_4H"]
data["BiasedEnergy"] = data["Lipid"] + data["Rg"] + data["Membrane"] + data["AMH-Go"] + 0.2*data["AMH_4H"]
data["BiasEnergy"] = 0.02 * (data["BiasTo"] - data["DisReal"])**2
data["Energy_with_all_bias"] = data["BiasEnergy"] + data["BiasedEnergy"]
In [3]:
data.columns
Out[3]:
In [4]:
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)
In [15]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-8, 0)
plt.xlim(40, 80)
# plt.clim(0, 20)
# plt.colorbar()
Out[15]:
In [5]:
t_pos = data.query("TempT == 373 and DisReal > 52 and DisReal < 57 and z_average > -4 and z_average < 0").reset_index(drop=True)
chosen = t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
# chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/aug21/low_e_jun01_pre.csv")
In [18]:
t_pos.hist("Lipid1",bins=50)
Out[18]:
In [20]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-8, 0)
plt.xlim(40, 80)
# plt.clim(0, 20)
# plt.colorbar()
Out[20]:
In [51]:
t_pos = data.query("TempT == 373 and DisReal > 57 and DisReal <63 and z_average > -5 and z_average < -2").reset_index(drop=True)
chosen = t_pos.query("Lipid1 < -0.5 and Lipid10 < -0.5").sort_values("Energy_with_all_bias").head(n=10)
# chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_jun01_transition.csv")
In [50]:
t_pos.query("Lipid1 < -0.5").plot.hexbin("Energy_with_all_bias", "Lipid10", cmap="seismic", sharex=False)
Out[50]:
In [41]:
chosen["Lipid10"]
Out[41]:
In [29]:
t_pos.query("Lipid1 < -0.5 and Lipid6 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
Out[29]:
In [52]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-8, 0)
plt.xlim(40, 80)
# plt.clim(0, 20)
# plt.colorbar()
Out[52]:
In [54]:
t_pos = data.query("TempT == 373 and DisReal > 63 and DisReal <72 and z_average > -6 and z_average < -3").reset_index(drop=True)
chosen = t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
# chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_jun01_post_transition.csv")
In [55]:
chosen
Out[55]:
In [5]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-15, 0)
plt.xlim(50, 120)
# plt.clim(0, 20)
# plt.colorbar()
Out[5]:
In [45]:
t = data.query("TempT == 373 and DisReal < 100 and Lipid1 < -0.3 and Lipid15 < -0.3 and DisReal > 50 and Lipid10 > -0.25")
t.plot.hexbin("Qw", "Lipid10", cmap="seismic", sharex=False)
Out[45]:
In [46]:
t.plot.hexbin("Qw", "DisReal", cmap="seismic", sharex=False)
Out[46]:
In [58]:
t_pos = data.query("TempT == 373 and DisReal < 100 and Lipid1 < -0.3 and Lipid15 < -0.3 and DisReal > 50 and Lipid10 > -0.25")
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_path1.csv")
In [57]:
t = data.query("TempT == 373 and Lipid1 > -0.5 and Qw > 0.3 and DisReal > 50")
t.plot.hexbin("Qw", "DisReal", cmap="seismic", sharex=False)
Out[57]:
In [59]:
t_pos = data.query("TempT == 373 and Lipid1 > -0.5 and Qw > 0.3 and DisReal > 50")
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_path2.csv")
In [ ]:
t_pos = data.query("TempT == 373 and DisReal > 80 and DisReal < 100 and z_average > -8 and z_average < -4").reset_index(drop=True)
t_pos.plot.hexbin("Energy_with_all_bias", "Lipid1", cmap="seismic", sharex=False)
In [193]:
t_pos = data.query("TempT == 373 and DisReal > 80 and DisReal < 100 and z_average > -8 and z_average < -4").reset_index(drop=True)
chosen = t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_jun01_h56.csv")
In [197]:
t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
Out[197]:
In [198]:
t_pos["chosen"] = (t_pos["Lipid1"] < -0.5) &(t_pos["z_h6"] < -10) & (t_pos["z_h3"] > -15)
a = t_pos["chosen"]
a.value_counts()
Out[198]:
In [194]:
t_pos.hist("z_h6",bins=50)
Out[194]:
In [186]:
t_pos.hist("Lipid1",bins=50)
Out[186]:
In [201]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.ylim(-15, 0)
# plt.xlim(50, 120)
In [203]:
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=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-20, -5)
plt.xlim(120, 200)
Out[203]:
In [25]:
t_pos = data.query("TempT == 373 and DisReal > 140 and DisReal < 180 and z_average > -14 and z_average < -8").reset_index(drop=True)
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.drop_duplicates(["Step", "Temp", "BiasTo"]).to_csv("/Users/weilu/Research/data/aug21/low_e_jun01_h34.csv")
In [213]:
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=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 [6]:
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=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)
plt.ylim(-20, -5)
plt.xlim(120, 300)
Out[6]:
In [26]:
t_pos = data.query("TempT == 373 and DisReal > 220 and DisReal < 250 and z_average > -14 and z_average < -10").reset_index(drop=True)
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.drop_duplicates(["Step", "Temp", "BiasTo"]).to_csv("/Users/weilu/Research/data/aug21/low_e_jun01_h12.csv")
In [ ]:
# zoom z -3, dis 240
In [17]:
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=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)
plt.ylim(0, -5)
plt.xlim(220, 250)
Out[17]:
In [27]:
t_pos = data.query("TempT == 373 and DisReal > 220 and DisReal < 250 and z_average > -5 and z_average < 0").reset_index(drop=True)
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.drop_duplicates(["Step", "Temp", "BiasTo"]).to_csv("/Users/weilu/Research/data/aug21/low_e_jun23.csv")
In [22]:
chosen
Out[22]:
In [35]:
chosen["DisReal"]
Out[35]:
In [28]:
t_pos = data.query("TempT == 373 and DisReal > 260 and z_average < -16").reset_index(drop=True)
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.drop_duplicates(["Step", "Temp", "BiasTo"]).to_csv("/Users/weilu/Research/data/aug21/low_e_jun01_out.csv")
In [ ]: