-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.avg_struc
76 lines (57 loc) · 1.85 KB
/
run.avg_struc
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
#!/bin/bash
#
# This script file generates an average structure of loaded
# trajs and outputs:
# 1. RMSD file aligned along CA values
# 2. average structure of only CA atoms
# 3. frame with closest RMSD @ CA to avg. structure
#
# TO RUN FILE:
# 1. In terminal: chmod u+x run.avg_struc
# 2. In terminal: ./run.avg_struc > run.avg_struc.log
#########################################
# load variables
#REC=STXBP4
#t=1us
ff=n
# stuff within EOF loads into cpptraj
cpptraj << EOF
# load prmtop
parm norre.stripped_1.rre.rev_${ff}.com.wat.leap.prmtop
# load traj files
trajin stripped.06-07_prod_revonly_${ff}_1.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_2.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_3.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_4.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_5.wat.nc
# align all CA atoms to first frame
rms first @CA
# output average pdb
average average.pdb PDB @CA
# average coordinates only CA
average crdset average_structure @CA
run
# output RMSD ref to avg_structure
rms ref average_structure @CA out test_avg.dat
run
quit
EOF
####################
# print out the frame that is the smallest RMSD
tail -n+3 test_avg.dat | awk 'NR == 1 || $2 < min {line = $0; min = $2}END{print line}'
# make that into a variable
number=`tail -n+3 test_avg.dat | awk 'NR == 1 || $2 < min {line = $0; min = $2}END{print line}' | awk '{print $1}'`
echo $number
####################
cpptraj << EOF
parm norre.stripped_1.rre.rev_${ff}.com.wat.leap.prmtop
trajin stripped.06-07_prod_revonly_${ff}_1.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_2.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_3.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_4.wat.nc
trajin stripped.06-07_prod_revonly_${ff}_5.wat.nc
# ouput the frame with lowest RMSD to avg structure
outtraj frame_closest_avg_${number}_${REC}.pdb onlyframes ${number}
run
quit
EOF