Browse Source

Improved bridges exhaustive search

Thomas Forest 4 years ago
parent
commit
e363f37ce0
4 changed files with 31 additions and 24 deletions
  1. 1 4
      src/atom.py
  2. 1 1
      src/dssp.py
  3. 1 1
      src/geometry.py
  4. 28 18
      src/structure.py

+ 1 - 4
src/atom.py View File

@@ -47,7 +47,4 @@ class Residue:
47 47
         r_CN = self.atoms["C"].dist_atoms(res2.atoms["N"])
48 48
         # Electrostatic interaction energy, in kcal/mole
49 49
         E = q1*q2*(1/r_ON + 1/r_CH - 1/r_OH - 1/r_CN)*f
50
-        if(E<-0.5):
51
-            return(True)
52
-        else:
53
-            return(False)
50
+        return(E)

+ 1 - 1
src/dssp.py View File

@@ -14,5 +14,5 @@ else:
14 14
     #print(pdb_file.residues[2].h_bond(pdb_file.residues[40]))
15 15
     #print(get_turns(pdb_file.residues))
16 16
     #print(pdb_file.residues[27].h_bond(pdb_file.residues[28]))
17
-    get_bridges(pdb_file.residues)
17
+    print(get_bridges(pdb_file.residues))
18 18
 

+ 1 - 1
src/geometry.py View File

@@ -3,4 +3,4 @@ class GeomObject:
3 3
     pass
4 4
 
5 5
 class Distance:
6
-    
6
+    pass

+ 28 - 18
src/structure.py View File

@@ -19,30 +19,40 @@ def get_turns(residues):
19 19
     for i,res in enumerate(residues):
20 20
         for j in range(3,6):
21 21
             if(i+j<len(residues)):
22
-                if(res.h_bond(residues[i+j])):
22
+                if(res.h_bond(residues[i+j]<-0.5)):
23 23
                     turns.append(Turn(j))
24 24
     return(turns)
25 25
 
26 26
 def get_bridges(residues):
27
-    # TODO : non-overlaping check to add
28 27
     bridges = []
29
-    for i,res in enumerate(residues):
30
-        for j, res in enumerate(residues):
31
-            if(i-1>=0 and i+1<len(residues)
32
-               and j-1>=0 and j+1<len(residues)):
33
-                if((residues[i-1].h_bond(residues[j])
34
-                    and residues[j].h_bond(residues[i+1]))
35
-                   or(residues[j-1].h_bond(residues[i])
36
-                      and residues[i].h_bond(residues[j+1]))):
37
-                    bridges.append(Bridge("para"))
28
+    for i in range(1,len(residues)-4):
29
+        E_min = 0
30
+        for j in range(i+2,len(residues)-1):
31
+            # select triplet with the minimal energy 
32
+
33
+            if(residues[i-1].h_bond(residues[j])<-0.5
34
+               and residues[j].h_bond(residues[i+1])<-0.5):
35
+                if(residues[i-1].h_bond(residues[j])+
36
+                   residues[j].h_bond(residues[i+1]))<E_min:
37
+                   E_min = residues[i-1].h_bond(residues[j])
38
+                   +residues[j].h_bond(residues[i+1])
39
+                   
40
+            if(residues[j-1].h_bond(residues[i])<-0.5
41
+               and residues[i].h_bond(residues[j+1])<-0.5):
42
+                if(residues[j-1].h_bond(residues[i])+
43
+                   residues[i].h_bond(residues[j+1]))<E_min:
44
+                   E_min = residues[j-1].h_bond(residues[i])
45
+                   +residues[i].h_bond(residues[j+1])
46
+                #bridges.append(Bridge("para"))
38 47
                     
39
-            if(i-1>=0 and i+1<len(residues)
40
-               and j-1>=0 and j+1<len(residues)):
41
-                if((residues[i].h_bond(residues[j])
42
-                    and residues[j].h_bond(residues[i]))
43
-                   or(residues[i-1].h_bond(residues[j+1])
44
-                      and residues[j-1].h_bond(residues[i+1]))):
45
-                    bridges.append(Bridge("anti"))
48
+                
49
+            if((residues[i].h_bond(residues[j])<-0.5
50
+                and residues[j].h_bond(residues[i])<-0.5)
51
+               or(residues[i-1].h_bond(residues[j+1])<-0.5
52
+                  and residues[j-1].h_bond(residues[i+1])<-0.5)):
53
+
54
+                #bridges.append(Bridge("anti"))
55
+        #bridges.append(strongest_bridge)
46 56
     return(bridges)
47 57
 
48 58
 def get_helix(turns):