Browse Source

Experimental get_sheets() function

Thomas Forest 5 years ago
parent
commit
bc420e4656
3 changed files with 40 additions and 9 deletions
  1. 1 0
      src/atom.py
  2. 2 1
      src/dssp.py
  3. 37 8
      src/structure.py

+ 1 - 0
src/atom.py View File

38
         #e = 1.602176634 * 10*math.exp(-19)
38
         #e = 1.602176634 * 10*math.exp(-19)
39
         # dimensionnal factor f
39
         # dimensionnal factor f
40
         f = 332
40
         f = 332
41
+        # partial charges
41
         q1 = 0.42
42
         q1 = 0.42
42
         q2 = 0.20
43
         q2 = 0.20
43
         # r, distance between O-N atoms, in angströms
44
         # r, distance between O-N atoms, in angströms

+ 2 - 1
src/dssp.py View File

20
     get_bends(pdb_file.residues)
20
     get_bends(pdb_file.residues)
21
     get_chirality(pdb_file.residues)
21
     get_chirality(pdb_file.residues)
22
     bridges = get_bridges(pdb_file.residues)
22
     bridges = get_bridges(pdb_file.residues)
23
-    get_ladders(bridges)
23
+    ladders = get_ladders(bridges)
24
+    get_sheets(ladders)

+ 37 - 8
src/structure.py View File

13
                         
13
                         
14
 class Bridge(Structure):
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
         self.bridge_type = bridge_type
17
         self.bridge_type = bridge_type
18
         self.res_num = res_num
18
         self.res_num = res_num
19
+        self.res_partner = res_partner
19
         Structure.res = res_num
20
         Structure.res = res_num
20
 
21
 
21
 class Helix(Structure):
22
 class Helix(Structure):
26
         Structure.res = res_num
27
         Structure.res = res_num
27
         
28
         
28
 def get_turns(residues):
29
 def get_turns(residues):
30
+    # TODO : prevent redondency of overlapping turns
29
     turns = {}
31
     turns = {}
30
     for i,res in enumerate(residues):
32
     for i,res in enumerate(residues):
31
         for j in range(3,6):
33
         for j in range(3,6):
103
         # finally add the strongest bridge at i and j pos
105
         # finally add the strongest bridge at i and j pos
104
         if(strongest_bridge):
106
         if(strongest_bridge):
105
             bridges[strongest_bridge['ipos']] = (Bridge(strongest_bridge['btype'],
107
             bridges[strongest_bridge['ipos']] = (Bridge(strongest_bridge['btype'],
106
-                                  strongest_bridge['ipos']))
108
+                                                        strongest_bridge['ipos'],
109
+                                                        strongest_bridge['jpos']))
107
             bridges[strongest_bridge['jpos']] = (Bridge(strongest_bridge['btype'],
110
             bridges[strongest_bridge['jpos']] = (Bridge(strongest_bridge['btype'],
108
-                                  strongest_bridge['jpos']))
111
+                                                        strongest_bridge['jpos'],
112
+                                                        strongest_bridge['ipos']))
109
     if(len(bridges)>0):
113
     if(len(bridges)>0):
110
         return(bridges)
114
         return(bridges)
111
     else:
115
     else:
134
     i = 1
138
     i = 1
135
     while i < len(bridges):
139
     while i < len(bridges):
136
         k = 1
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
         if k>1:
147
         if k>1:
141
             ladders[bridges[i].res_num] = k-1
148
             ladders[bridges[i].res_num] = k-1
142
             print("ladder", bridges[i].res_num, bridges[i+k-1].res_num)
149
             print("ladder", bridges[i].res_num, bridges[i+k-1].res_num)
143
             ladders[bridges[i].res_num] = {'start':bridges[i].res_num,
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
             i+=k-1
153
             i+=k-1
146
         else:
154
         else:
147
             i+=1
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
 def get_bends(residues):
181
 def get_bends(residues):
153
     bends = {}
182
     bends = {}
154
     for i in range(2,len(residues)-2):
183
     for i in range(2,len(residues)-2):