|
@@ -262,8 +262,9 @@ def connected_ladders(ladd_1, ladd_2):
|
262
|
262
|
links = []
|
263
|
263
|
for bridge in ladd_1['bridges']:
|
264
|
264
|
if bridge.res_partner in res_list(ladd_2):
|
265
|
|
- return([ladd_1['i'], ladd_1['j'], bridge.i, bridge.j,
|
266
|
|
- ladd_2['i'], ladd_2['j']])
|
|
265
|
+ # return([ladd_1['i'], ladd_1['j'], bridge.i, bridge.j,
|
|
266
|
+ # ladd_2['i'], ladd_2['j']])
|
|
267
|
+ return ladd_2
|
267
|
268
|
|
268
|
269
|
return False
|
269
|
270
|
|
|
@@ -276,29 +277,44 @@ def get_sheets(ladders):
|
276
|
277
|
"""
|
277
|
278
|
ladds = [ elem for elem in ladders.values() ]
|
278
|
279
|
sheets = {}
|
279
|
|
- i = 0
|
280
|
|
- while i < len(ladds):
|
281
|
|
- j = i+1
|
282
|
|
- ladd = ladds[i]
|
283
|
|
- ladd1 = ladds[i]
|
284
|
|
- ladd2 = ladds[j]
|
285
|
280
|
|
286
|
|
- while j < len(ladds):
|
287
|
|
- print(connected_ladders(ladd1, ladd2))
|
|
281
|
+ corresp = {}
|
|
282
|
+ for ladd1 in ladds:
|
|
283
|
+ for ladd2 in ladds:
|
288
|
284
|
if connected_ladders(ladd1, ladd2)!=False:
|
289
|
|
- ladd1 = ladd2
|
290
|
|
- #print(connected_ladders(ladd1, ladd2)[4])
|
291
|
|
- ladd2 = ladders[connected_ladders(ladd1, ladd2)[4]]
|
292
|
|
- j+=1
|
293
|
|
- print(ladd['i'], ladd2['i'])
|
294
|
|
- i+=1
|
295
|
|
- # for ladder in ladders:
|
296
|
|
- # for ladd2 in ladders:
|
297
|
|
- # if connected_ladders(ladders[ladder], ladders[ladd2]):
|
298
|
|
- # pass
|
299
|
|
- #print("ladder",ladders[ladder]['i'], ladders[ladder]['j'],"bridge",bridge.i, bridge.j,
|
300
|
|
- # "ladder 2",ladders[ladd2]['i'], ladders[ladd2]['j'])
|
|
285
|
+ corresp_list = [ elem for elem in corresp.keys() ]
|
|
286
|
+ if ladd1['i'] not in corresp_list and ladd2['i'] not in corresp_list:
|
|
287
|
+ ind = len(sheets.keys())
|
|
288
|
+ sheets[ind] = []
|
|
289
|
+ sheets[ind].append(ladd1)
|
|
290
|
+ sheets[ind].append(ladd2)
|
|
291
|
+ corresp[ladd1['i']] = ind
|
|
292
|
+ corresp[ladd2['i']] = ind
|
|
293
|
+ elif ladd2 not in corresp_list and ladd1 in corresp_list:
|
|
294
|
+ sheets[corresp[ladd1['i']]].append(ladd2)
|
|
295
|
+ corresp[ladd2['i']] = corresp[ladd1['i']]
|
|
296
|
+ elif ladd1 not in corresp_list and ladd2 in corresp_list:
|
|
297
|
+ sheets[corresp[ladd2['i']]].append(ladd1)
|
|
298
|
+ corresp[ladd1['i']] = corresp[ladd2['i']]
|
|
299
|
+
|
|
300
|
+ return sheets
|
|
301
|
+
|
|
302
|
+def get_sheets2(ladders):
|
|
303
|
+ """
|
|
304
|
+ Bridges between ladders.
|
|
305
|
+ Check if 1 bridge between one ladder and one or more other ladders.
|
|
306
|
+ Iterate over all residues of one ladder and check if bridge with other residues
|
|
307
|
+ of the other ladders.
|
|
308
|
+ """
|
|
309
|
+ sheets = {}
|
|
310
|
+ for ladder in ladders:
|
|
311
|
+ for ladd2 in ladders:
|
|
312
|
+ if connected_ladders(ladders[ladder], ladders[ladd2]):
|
|
313
|
+ pass
|
|
314
|
+ print("ladder",ladders[ladder]['i'], ladders[ladder]['j'],"bridge",bridge.i, bridge.j,
|
|
315
|
+ "ladder 2",ladders[ladd2]['i'], ladders[ladd2]['j'])
|
301
|
316
|
|
|
317
|
+
|
302
|
318
|
def res_list(ladder):
|
303
|
319
|
# TODO : method in ladder class
|
304
|
320
|
l=[]
|