Browse Source

Correction of Bends residues

Thomas Forest 5 years ago
parent
commit
dfeb566ee0
3 changed files with 12 additions and 8 deletions
  1. 3 1
      src/atom.py
  2. 3 1
      src/pdb.py
  3. 6 6
      src/structure.py

+ 3 - 1
src/atom.py View File

@@ -8,12 +8,13 @@ class Atom:
8 8
 
9 9
 
10 10
     def __init__(self, atom_id, atom_name, res_name, chain_id,
11
-                 res_seq_nb, coordinates):
11
+                 res_seq_nb, insertion_code, coordinates):
12 12
         self.atom_id = atom_id
13 13
         self.atom_name = atom_name
14 14
         self.res_name = res_name
15 15
         self.chain_id = chain_id
16 16
         self.res_seq_nb = res_seq_nb
17
+        self.insertion_code = insertion_code
17 18
         self.coord_x = coordinates[0]
18 19
         self.coord_y = coordinates[1]
19 20
         self.coord_z = coordinates[2]
@@ -27,6 +28,7 @@ class Residue:
27 28
             self.resid = atom.res_seq_nb
28 29
             self.res_name = atom.res_name
29 30
             self.chain_id = atom.chain_id
31
+            self.insertion_code = atom.insertion_code
30 32
             
31 33
             
32 34
     def h_bond(self, res2):

+ 3 - 1
src/pdb.py View File

@@ -39,8 +39,9 @@ class PDBFile:
39 39
                 atom = Atom(atom_id = int(line[6:11].strip()),
40 40
                             atom_name = line[12:16].strip(),
41 41
                             res_name = line[17:20].strip(),
42
-                            chain_id = line[21:22].strip(),
42
+                            chain_id = line[21:22],
43 43
                             res_seq_nb = int(line[22:26].strip()),
44
+                            insertion_code = line[26:27],
44 45
                             coordinates = [float(line[30:38].strip()),
45 46
                                      float(line[38:46].strip()),
46 47
                                      float(line[46:54].strip()),
@@ -91,6 +92,7 @@ class PDBFile:
91 92
                                 res_name = resi.res_name,
92 93
                                 chain_id = resi.chain_id,
93 94
                                 res_seq_nb = resi.resid,
95
+                                insertion_code = resi.insertion_code,
94 96
                                 coordinates = [hydrogen[2],
95 97
                                                hydrogen[3],
96 98
                                                hydrogen[4]])

+ 6 - 6
src/structure.py View File

@@ -121,8 +121,8 @@ def get_helix(residues, turns):
121 121
                 k+=1
122 122
                 temp_res.append(residues[i])
123 123
             if(k>2):
124
-                print(k,"- HELIX at", i)
125
-                helix.append(Helix(temp_res,i))
124
+                print(k,"- HELIX at", residues[i].resid)
125
+                helix.append(Helix(temp_res,residues[i].resid))
126 126
             i = i+k
127 127
         else:
128 128
             i+=1
@@ -140,7 +140,7 @@ def get_bends(residues):
140 140
                               vectors_substr(position_vector(residues[i+2].atoms["CA"].coords),
141 141
                                              position_vector(residues[i].atoms["CA"].coords)))
142 142
         if(angle>70):
143
-            print("angle", i+1, angle)
143
+            print("angle", residues[i].resid, angle)
144 144
     return(bends)
145 145
 
146 146
 def vecteur_deux_points (a, b):
@@ -175,9 +175,9 @@ def position_vector(c):
175 175
     return vector
176 176
 
177 177
 def vectors_substr(v1, v2):
178
-    return ([v2[0]-v1[0],
179
-             v2[1]-v1[1],
180
-             v2[2]-v1[2]])
178
+    return ([v1[0]-v2[0],
179
+             v1[1]-v2[1],
180
+             v1[2]-v2[2]])
181 181
 
182 182
 def vector_angles(v1,v2):
183 183
     dot_prod = dot_product(v1,v2)