-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdata_read.py
More file actions
executable file
·109 lines (99 loc) · 3.83 KB
/
data_read.py
File metadata and controls
executable file
·109 lines (99 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python3
# @Author: Wei Lu <weilu>
# @Date: 25-Jan-2017
# @Email: wl45@rice.edu
# @Last modified by: weilu
# @Last modified time: 25-Jan-2017
# @Copyright: Free
import os
import sys
import argparse
import platform
from datetime import datetime
import imp
from myPersonalFunctions import *
import glob
import numpy as np
import datetime
import pandas as pd
import re
from small_script.myFunctions import readPMF
from small_script.myFunctions import readPMF_2
# Useful codes
# os.system("awk '{print $NF}' all_wham.dat > e_total")
# tr " " "\n"
# sed 1d
# sort -u -k 3
# sed -e 's/+T//'
parser = argparse.ArgumentParser(description="Analysis code, need run multiple times")
# parser.add_argument("protein", help="the name of protein")
# parser.add_argument("template", help="the name of template file")
parser.add_argument("-t", "--test", help="test ", action="store_true", default=False)
parser.add_argument("-d", "--debug", action="store_true", default=False)
parser.add_argument("-l", "--label")
parser.add_argument("--dimension", type=int, default=2)
parser.add_argument("-m", "--mode", type=int, default=0)
parser.add_argument("--force", type=float, default=1.0)
parser.add_argument("-p", "--patch", type=int, default=1)
parser.add_argument("--commons", type=int, default=0)
parser.add_argument("--nsample", type=int, default=2500)
parser.add_argument("--submode", type=int, default=-1)
args = parser.parse_args()
if(args.debug):
do = print
cd = print
else:
do = os.system
cd = os.chdir
label = args.label
if(args.test):
print("hello world")
if args.mode == 0:
data = readPMF(".")
elif args.mode == 1:
data = readPMF_2(".") # read all 1d_dis, 1d_qw and 1d_z
elif args.mode ==3:
all_pmf_list = []
simulation_list = ["memb_3_rg_0.1_lipid_1_extended", "memb_3_rg_0.1_lipid_1_topology"]
for simulation in simulation_list:
for mode in range(3):
cd(f"nov_15_all_freeEnergy_calculation_sample_range_mode_{mode}")
cd(simulation)
tmp = readPMF_2(".").assign(submode=mode, simulation=simulation)
all_pmf_list.append(tmp)
cd("../..")
data = pd.concat(all_pmf_list).reset_index(drop=True)
elif args.mode ==4:
all_pmf_list = []
simulation_list = ["next_gen_native_based_memb_3_rg_0.2_lipid_0.6_extended",
"next_gen_native_based_memb_3_rg_0.4_lipid_0.6_extended",
"next_gen_native_based_memb_3_rg_0.4_lipid_0.6_topology"]
cd(f"all_freeEnergy_calculation_nov11")
for simulation in simulation_list:
cd(simulation)
tmp = readPMF_2(".").assign(submode="0", simulation=simulation)
all_pmf_list.append(tmp)
cd("..")
data = pd.concat(all_pmf_list).reset_index(drop=True)
# data = readPMF(".")
elif args.mode ==5:
all_pmf_list = []
simulation_list = ["new_next_gen_native_based_memb_3_rg_0.4_lipid_0.6_extended", "new_next_gen_native_based_memb_3_rg_0.4_lipid_0.6_extended_2", "new_next_gen_native_based_memb_3_rg_0.4_lipid_0.6_extendedshort"]
for simulation in simulation_list:
for mode in range(3):
cd(f"nov_18_all_freeEnergy_calculation_sample_range_mode_{mode}")
cd(simulation)
tmp = readPMF_2(".").assign(submode=mode, simulation=simulation)
all_pmf_list.append(tmp)
cd("../..")
data = pd.concat(all_pmf_list).reset_index(drop=True)
elif args.mode == 6:
data = readPMF_2(".", is2d=1) # read all 2d
if args.mode != 6:
remove_columns = ['bin']
data = data.drop(remove_columns, axis=1)
destiny = f"{label}_{datetime.datetime.today().strftime('%d_%h_%H%M%S')}.feather"
print(destiny)
data.to_feather(destiny)
os.system(f"cp {destiny} /Users/weilu/Research/data/pulling/{destiny}")
# destiny = f"/Users/weilu/Research/data/pulling/{datetime.datetime.today().strftime('%d_%h')}_data_{label}.feather"