|
@@ -52,17 +52,23 @@ class Residue:
|
52
|
52
|
E = q1*q2*(1/r_ON + 1/r_CH - 1/r_OH - 1/r_CN)*f
|
53
|
53
|
return(E)
|
54
|
54
|
|
55
|
|
- def get_turns(self, residues, turns):
|
|
55
|
+ def get_turns(self, residues):
|
56
|
56
|
"""
|
57
|
57
|
Get all the turns from a specific residue.
|
58
|
58
|
"""
|
|
59
|
+ turns = {}
|
59
|
60
|
i = residues.index(self)
|
|
61
|
+ k = 0
|
60
|
62
|
for j in range(3,6):
|
61
|
63
|
if(i+j<len(residues)):
|
62
|
64
|
if(self.h_bond(residues[i+j])<-0.5):
|
63
|
|
- print(j,"TURN", residues[i].resid, residues[i+j].resid)
|
64
|
|
- turns[i] = Turn(j,residues[i].resid)
|
|
65
|
+ k = j
|
|
66
|
+ if k != 0:
|
|
67
|
+ #print(k,"TURN", residues[i].resid, residues[i+k].resid)
|
|
68
|
+ return Turn(k,residues[i].resid)
|
65
|
69
|
|
|
70
|
+ return False
|
|
71
|
+
|
66
|
72
|
def get_bridges(self, residues):
|
67
|
73
|
bridges = {}
|
68
|
74
|
bridge = {}
|
|
@@ -124,22 +130,38 @@ class Residue:
|
124
|
130
|
else:
|
125
|
131
|
return(False)
|
126
|
132
|
|
127
|
|
- def get_helix(self, residues, turns):
|
|
133
|
+ def get_helix(self, residues):
|
128
|
134
|
"""
|
129
|
135
|
Return if there is an helix at a given residue,
|
130
|
136
|
as well as its type.
|
131
|
137
|
"""
|
132
|
138
|
i = residues.index(self)
|
133
|
139
|
# if there are no turns or it is the first residue, skip
|
134
|
|
- if not turns or i == 0:
|
|
140
|
+ if i == 0:
|
135
|
141
|
return False
|
136
|
|
- if (i <= len(residues)):
|
137
|
|
- if(i in turns.keys() and i-1 in turns.keys()):
|
138
|
|
- print(turns[i].turn_type,"- HELIX at", residues[i].resid)
|
139
|
|
- return(turns[i].turn_type, residues[i].resid)
|
|
142
|
+
|
|
143
|
+ if(self.get_turns(residues) and residues[i-1].get_turns(residues)):
|
|
144
|
+ print(self.get_turns(residues).turn_type,"- HELIX at", residues[i].resid)
|
|
145
|
+ return(self.get_turns(residues).turn_type, residues[i].resid)
|
|
146
|
+ return(False)
|
|
147
|
+
|
|
148
|
+ def get_helix2(self, residues):
|
|
149
|
+ """
|
|
150
|
+ Return if there is an helix at a given residue,
|
|
151
|
+ as well as its type.
|
|
152
|
+ """
|
|
153
|
+ i = residues.index(self)
|
|
154
|
+ # if there are no turns or it is the first residue, skip
|
|
155
|
+ if i == 0:
|
|
156
|
+ return False
|
|
157
|
+
|
|
158
|
+ if(i in turns.keys() and i-1 in turns.keys()):
|
|
159
|
+ print(turns[i].turn_type,"- HELIX at", residues[i].resid)
|
|
160
|
+ return(turns[i].turn_type, residues[i].resid)
|
140
|
161
|
return(False)
|
141
|
162
|
|
142
|
|
- def get_ladders(self, residues, ladders):
|
|
163
|
+ def get_ladders(self, residues, ladders={}):
|
|
164
|
+ #ladders = {}
|
143
|
165
|
i = residues.index(self)
|
144
|
166
|
if i != 0:
|
145
|
167
|
if self.get_bridges(residues):
|
|
@@ -151,6 +173,70 @@ class Residue:
|
151
|
173
|
ladders[i] = {'start':i-1,
|
152
|
174
|
'end':i,
|
153
|
175
|
'bridges':[consec_bridge, local_bridge]}
|
|
176
|
+ return ladders
|
|
177
|
+
|
|
178
|
+ def get_ladder(self, residues):
|
|
179
|
+ #ladders = {}
|
|
180
|
+ i = residues.index(self)
|
|
181
|
+ if i != 0:
|
|
182
|
+ if self.get_bridges(residues):
|
|
183
|
+ if (residues[i-1].get_bridges(residues)):
|
|
184
|
+ local_bridge = self.get_bridges(residues)
|
|
185
|
+ consec_bridge = residues[i-1].get_bridges(residues)
|
|
186
|
+ if local_bridge.bridge_type == consec_bridge.bridge_type:
|
|
187
|
+ #print("ladder", consec_bridge.res_num, local_bridge.res_num)
|
|
188
|
+ ladder = {'start':consec_bridge.res_num,
|
|
189
|
+ 'end':local_bridge.res_num,
|
|
190
|
+ 'bridges':[consec_bridge, local_bridge]}
|
|
191
|
+ return ladder
|
|
192
|
+ return False
|
|
193
|
+
|
|
194
|
+ def get_sheets(self, residues):
|
|
195
|
+ """
|
|
196
|
+ Bridges between ladders.
|
|
197
|
+ Check if 1 bridge between one ladder and one or more other ladders.
|
|
198
|
+ Iterate over all residues of one ladder and check if bridge with other residues
|
|
199
|
+ of the other ladders.
|
|
200
|
+ """
|
|
201
|
+ sheets = {}
|
|
202
|
+ sheet_start = residues.index(self)
|
|
203
|
+ j=sheet_start
|
|
204
|
+ k=2
|
|
205
|
+ if(self.get_ladder(residues)):
|
|
206
|
+ local_ladder = self.get_ladder(residues)
|
|
207
|
+ while j < len(residues)-2:
|
|
208
|
+ k = 2
|
|
209
|
+ while residues[j+k].get_ladder(residues):
|
|
210
|
+ if(residues[j+k].get_bridges(residues)):
|
|
211
|
+ j = j+k
|
|
212
|
+ k+=1
|
|
213
|
+ if(k>):
|
|
214
|
+ last = j
|
|
215
|
+ j+=1
|
|
216
|
+ print(j)
|
|
217
|
+ if(k>2):
|
|
218
|
+ sheet_end = last
|
|
219
|
+
|
|
220
|
+ print("SHEET", sheet_start, sheet_end)
|
|
221
|
+
|
|
222
|
+ def get_sheets2(self):
|
|
223
|
+ """
|
|
224
|
+ Bridges between ladders.
|
|
225
|
+ Check if 1 bridge between one ladder and one or more other ladders.
|
|
226
|
+ Iterate over all residues of one ladder and check if bridge with other residues
|
|
227
|
+ of the other ladders.
|
|
228
|
+ """
|
|
229
|
+ sheets = {}
|
|
230
|
+ for ladder in ladders:
|
|
231
|
+ for ladd2 in ladders:
|
|
232
|
+ for bridge in ladders[ladder]['bridges']:
|
|
233
|
+ if bridge.res_partner in res_list(ladders[ladd2]):
|
|
234
|
+ print("ladder",ladders[ladder]['start'], ladders[ladder]['end'],"bridge",bridge.res_num, bridge.res_partner,
|
|
235
|
+ "ladder 2",ladders[ladd2]['start'], ladders[ladd2]['end'])
|
|
236
|
+ #print("stop ladder 2")
|
|
237
|
+ print("stop ladder 1")
|
|
238
|
+
|
|
239
|
+
|
154
|
240
|
|
155
|
241
|
def get_ladders2(self, bridges, residues):
|
156
|
242
|
ladders = {}
|