|
@@ -13,9 +13,10 @@ class Turn(Structure):
|
13
|
13
|
|
14
|
14
|
class Bridge(Structure):
|
15
|
15
|
|
16
|
|
- def __init__(self, bridge_type, res_num):
|
|
16
|
+ def __init__(self, bridge_type, res_num, res_partner):
|
17
|
17
|
self.bridge_type = bridge_type
|
18
|
18
|
self.res_num = res_num
|
|
19
|
+ self.res_partner = res_partner
|
19
|
20
|
Structure.res = res_num
|
20
|
21
|
|
21
|
22
|
class Helix(Structure):
|
|
@@ -26,6 +27,7 @@ class Helix(Structure):
|
26
|
27
|
Structure.res = res_num
|
27
|
28
|
|
28
|
29
|
def get_turns(residues):
|
|
30
|
+ # TODO : prevent redondency of overlapping turns
|
29
|
31
|
turns = {}
|
30
|
32
|
for i,res in enumerate(residues):
|
31
|
33
|
for j in range(3,6):
|
|
@@ -103,9 +105,11 @@ def get_bridges(residues):
|
103
|
105
|
# finally add the strongest bridge at i and j pos
|
104
|
106
|
if(strongest_bridge):
|
105
|
107
|
bridges[strongest_bridge['ipos']] = (Bridge(strongest_bridge['btype'],
|
106
|
|
- strongest_bridge['ipos']))
|
|
108
|
+ strongest_bridge['ipos'],
|
|
109
|
+ strongest_bridge['jpos']))
|
107
|
110
|
bridges[strongest_bridge['jpos']] = (Bridge(strongest_bridge['btype'],
|
108
|
|
- strongest_bridge['jpos']))
|
|
111
|
+ strongest_bridge['jpos'],
|
|
112
|
+ strongest_bridge['ipos']))
|
109
|
113
|
if(len(bridges)>0):
|
110
|
114
|
return(bridges)
|
111
|
115
|
else:
|
|
@@ -134,21 +138,46 @@ def get_ladders(bridges):
|
134
|
138
|
i = 1
|
135
|
139
|
while i < len(bridges):
|
136
|
140
|
k = 1
|
137
|
|
- while (((i in bridges.keys()) and (i+k in bridges.keys())) and
|
138
|
|
- (bridges[i].bridge_type == bridges[i+k].bridge_type)):
|
139
|
|
- k+=1
|
|
141
|
+ if i in bridges.keys():
|
|
142
|
+ temp_bridges = [bridges[i]]
|
|
143
|
+ while ((i+k in bridges.keys()) and
|
|
144
|
+ (bridges[i].bridge_type == bridges[i+k].bridge_type)):
|
|
145
|
+ temp_bridges.append(bridges[i+k])
|
|
146
|
+ k+=1
|
140
|
147
|
if k>1:
|
141
|
148
|
ladders[bridges[i].res_num] = k-1
|
142
|
149
|
print("ladder", bridges[i].res_num, bridges[i+k-1].res_num)
|
143
|
150
|
ladders[bridges[i].res_num] = {'start':bridges[i].res_num,
|
144
|
|
- 'end':bridges[i+k-1].res_num}
|
|
151
|
+ 'end':bridges[i+k-1].res_num,
|
|
152
|
+ 'bridges':temp_bridges}
|
145
|
153
|
i+=k-1
|
146
|
154
|
else:
|
147
|
155
|
i+=1
|
148
|
|
- return ladders
|
|
156
|
+ return ladders
|
149
|
157
|
|
|
158
|
+def get_sheets(ladders):
|
|
159
|
+ """
|
|
160
|
+ Bridges between ladders.
|
|
161
|
+ Check if 1 bridge between one ladder and one or more other ladders.
|
|
162
|
+ Iterate over all residues of one ladder and check if bridge with other residues
|
|
163
|
+ of the other ladders.
|
|
164
|
+ """
|
150
|
165
|
|
|
166
|
+ for ladder in ladders:
|
|
167
|
+ for bridge in ladders[ladder]['bridges']:
|
|
168
|
+ for ladd2 in ladders:
|
|
169
|
+ if bridge.res_partner in res_list(ladders[ladd2]):
|
|
170
|
+ print("ladder",ladders[ladder]['start'], ladders[ladder]['end'],"bridge",bridge.res_num, bridge.res_partner,
|
|
171
|
+ "ladder 2",ladders[ladd2]['start'], ladders[ladd2]['end'])
|
151
|
172
|
|
|
173
|
+
|
|
174
|
+def res_list(ladder):
|
|
175
|
+ # TODO : method in ladder class
|
|
176
|
+ l=[]
|
|
177
|
+ for i in range(ladder['start'], ladder['end']):
|
|
178
|
+ l.append(i)
|
|
179
|
+ return(l)
|
|
180
|
+
|
152
|
181
|
def get_bends(residues):
|
153
|
182
|
bends = {}
|
154
|
183
|
for i in range(2,len(residues)-2):
|