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 Plot RMSD, Energy of ensemble trajectory.
26 """
27
28 from os.path import dirname
29
30 import tools as T
31 from Biskit import Trajectory, EHandler
32 from Biskit.EnsembleTraj import traj2ensemble, EnsembleTraj
33
34 from PVM import JobSlave
35
37 """
38 Plot RMSD, Energy of ensemble trajectory.
39 """
40
42 """
43 Copy the parameters that Master is passing in as dict into
44 fields of this class.
45
46 @param params: defined in Master
47 @type params: dict
48 """
49 pass
50
51
52 - def go( self, dict ):
53 """
54 Calculate rmsd values for trajectory and plot them.
55
56 @param dict: dictionary with path to trajectories as values
57 @type dict: dict
58
59 @return: dictionary with path to trajectories as values
60 @rtype: dict
61 """
62 for k, f in dict.items():
63
64 fout = dirname( f )+'/'+'%s'+ T.stripFilename(f)+'.eps'
65 fshort = dirname( f )[-15:]
66
67 print fshort
68
69 t = self.loadTraj( f )
70
71 self.calcRmsd( t )
72
73 p = self.plotRmsdRef(t, fshort )
74 p.write_eps( fout % 'rms_', width="18cm", height="29cm" )
75
76 print "Done"
77
78 return dict
79
80
82 """
83 Load trajectories from disc.
84
85 @param ftraj: path to trajectory
86 @type ftraj: str
87
88 @return: ensemble trajectory object
89 @rtype: EnsembleTraj
90 """
91 t = T.Load( T.absfile( ftraj ) )
92 return traj2ensemble( t )
93
94
96 """
97 Calculate the rmsd to the reference, the CA rmsd to the average
98 member and the CA rmsd to last member frame. Add the results
99 into a profile.
100
101 @param t: ensemble trajectory object
102 @type t: EnsembleTraj
103 """
104 mCA = t.ref.maskCA()
105
106 t.fit( ref=t.ref, prof='rms_all_ref', comment='all heavy')
107
108 t.fitMembers( mask=mCA, prof='rms_CA_av', comment='CA to member avg')
109
110 t.fitMembers( refIndex=-1, mask=mCA, prof='rms_CA_last',
111 comment='all CA to last member frame')
112
113
115 """
116 Plot the rmsd profiles calculated in L{ calcRmsd }.
117
118 @param t: ensemble trajectory object
119 @type t: EnsembleTraj
120 @param title: plot title
121 @type title: str
122
123 @return: biggles plot object
124 @rtype: biggles.FramedPlot
125 """
126 p = t.plotMemberProfiles('rms_all_ref', 'rms_CA_av', 'rms_CA_last')
127 p.title = title
128 p.xlabel= 'frame #'
129 p.ylabel= 'RMSD [A]'
130 return p
131
132
133 if __name__ == '__main__':
134
135 import os, sys
136
137 if len(sys.argv) == 2:
138
139 niceness = int(sys.argv[1])
140 os.nice(niceness)
141
142 slave = QualSlave()
143 slave.start()
144