Browse Source

Fixing ladder discovery

Thomas Forest 5 years ago
parent
commit
7ddd47c379
2 changed files with 18 additions and 16 deletions
  1. 3 3
      src/dssp.py
  2. 15 13
      src/structure.py

+ 3 - 3
src/dssp.py View File

25
     get_helix(pdb_file.residues, turns)
25
     get_helix(pdb_file.residues, turns)
26
     # get_bends(pdb_file.residues)
26
     # get_bends(pdb_file.residues)
27
     # get_chirality(pdb_file.residues)
27
     # get_chirality(pdb_file.residues)
28
-    # bridges = get_bridges(pdb_file.residues)
29
-    # ladders = get_ladders(bridges)
30
-    # get_sheets(ladders)
28
+    bridges = get_bridges(pdb_file.residues)
29
+    ladders = get_ladders(bridges, pdb_file.residues)
30
+    get_sheets(ladders)
31
 
31
 
32
     # print("NBRIDGES",len(bridges))
32
     # print("NBRIDGES",len(bridges))
33
 
33
 

+ 15 - 13
src/structure.py View File

83
                     E_min = bridge['res1']+bridge['res2']
83
                     E_min = bridge['res1']+bridge['res2']
84
                     strongest_bridge = bridge
84
                     strongest_bridge = bridge
85
                     bridge = {}
85
                     bridge = {}
86
+                    coord_bridge = [i,j]
86
         # finally add the strongest bridge at i and j pos
87
         # finally add the strongest bridge at i and j pos
87
         if(strongest_bridge):
88
         if(strongest_bridge):
88
-            bridges[strongest_bridge['ipos']] = (Bridge(strongest_bridge['btype'],
89
+            bridges[coord_bridge[0]] = (Bridge(strongest_bridge['btype'],
89
                                                         strongest_bridge['ipos'],
90
                                                         strongest_bridge['ipos'],
90
                                                         strongest_bridge['jpos']))
91
                                                         strongest_bridge['jpos']))
91
-            # bridges[strongest_bridge['jpos']] = (Bridge(strongest_bridge['btype'],
92
-            #                                             strongest_bridge['jpos'],
93
-            #                                             strongest_bridge['ipos']))
92
+            bridges[coord_bridge[1]] = (Bridge(strongest_bridge['btype'],
93
+                                                        strongest_bridge['jpos'],
94
+                                                        strongest_bridge['ipos']))
94
     if(len(bridges)>0):
95
     if(len(bridges)>0):
95
         return(bridges)
96
         return(bridges)
96
     else:
97
     else:
143
             while(i+k in turns):
144
             while(i+k in turns):
144
                 k+=1
145
                 k+=1
145
                 temp_res.append(residues[i])
146
                 temp_res.append(residues[i])
146
-            if(k>2):
147
+            if(k>=1):
147
                 print(k,"- HELIX at", residues[i].resid)
148
                 print(k,"- HELIX at", residues[i].resid)
148
                 helix.append(Helix(temp_res,residues[i].resid))
149
                 helix.append(Helix(temp_res,residues[i].resid))
149
             i = i+k
150
             i = i+k
151
             i+=1
152
             i+=1
152
     return(helix)
153
     return(helix)
153
 
154
 
154
-def get_ladders(bridges):
155
+def get_ladders(bridges, residues):
155
     ladders = {}
156
     ladders = {}
156
     i = 1
157
     i = 1
157
-    while i < len(bridges):
158
+    while i < len(residues):
158
         k = 1
159
         k = 1
159
         if i in bridges.keys():
160
         if i in bridges.keys():
160
             temp_bridges = [bridges[i]]
161
             temp_bridges = [bridges[i]]
163
                 temp_bridges.append(bridges[i+k])
164
                 temp_bridges.append(bridges[i+k])
164
                 k+=1
165
                 k+=1
165
         if k>1:
166
         if k>1:
166
-            ladders[bridges[i].res_num] = k-1
167
+            ladders[i] = k-1
167
             print("ladder", bridges[i].res_num, bridges[i+k-1].res_num)
168
             print("ladder", bridges[i].res_num, bridges[i+k-1].res_num)
168
-            ladders[bridges[i].res_num] = {'start':bridges[i].res_num,
169
+            ladders[i] = {'start':bridges[i].res_num,
169
                                            'end':bridges[i+k-1].res_num,
170
                                            'end':bridges[i+k-1].res_num,
170
                                            'bridges':temp_bridges}
171
                                            'bridges':temp_bridges}
171
             i+=k-1
172
             i+=k-1
180
     Iterate over all residues of one ladder and check if bridge with other residues
181
     Iterate over all residues of one ladder and check if bridge with other residues
181
     of the other ladders.
182
     of the other ladders.
182
     """
183
     """
183
-
184
+    sheets = {}
184
     for ladder in ladders:
185
     for ladder in ladders:
185
-        for bridge in ladders[ladder]['bridges']:
186
-            for ladd2 in ladders:
186
+        for ladd2 in ladders:
187
+            for bridge in ladders[ladder]['bridges']:
187
                 if bridge.res_partner in res_list(ladders[ladd2]):
188
                 if bridge.res_partner in res_list(ladders[ladd2]):
188
                     print("ladder",ladders[ladder]['start'], ladders[ladder]['end'],"bridge",bridge.res_num, bridge.res_partner,
189
                     print("ladder",ladders[ladder]['start'], ladders[ladder]['end'],"bridge",bridge.res_num, bridge.res_partner,
189
                     "ladder 2",ladders[ladd2]['start'], ladders[ladd2]['end'])
190
                     "ladder 2",ladders[ladd2]['start'], ladders[ladd2]['end'])
190
-                
191
+            #print("stop ladder 2")
192
+        print("stop ladder 1")            
191
 
193
 
192
 def res_list(ladder):
194
 def res_list(ladder):
193
     # TODO : method in ladder class
195
     # TODO : method in ladder class