Procházet zdrojové kódy

Fixing ladder discovery

Thomas Forest před 5 roky
rodič
revize
7ddd47c379
2 změnil soubory, kde provedl 18 přidání a 16 odebrání
  1. 3 3
      src/dssp.py
  2. 15 13
      src/structure.py

+ 3 - 3
src/dssp.py Zobrazit soubor

@@ -25,9 +25,9 @@ else:
25 25
     get_helix(pdb_file.residues, turns)
26 26
     # get_bends(pdb_file.residues)
27 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 32
     # print("NBRIDGES",len(bridges))
33 33
 

+ 15 - 13
src/structure.py Zobrazit soubor

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