Browse Source

Correction of Bends residues

Thomas Forest 4 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
 
8
 
9
 
9
 
10
     def __init__(self, atom_id, atom_name, res_name, chain_id,
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
         self.atom_id = atom_id
12
         self.atom_id = atom_id
13
         self.atom_name = atom_name
13
         self.atom_name = atom_name
14
         self.res_name = res_name
14
         self.res_name = res_name
15
         self.chain_id = chain_id
15
         self.chain_id = chain_id
16
         self.res_seq_nb = res_seq_nb
16
         self.res_seq_nb = res_seq_nb
17
+        self.insertion_code = insertion_code
17
         self.coord_x = coordinates[0]
18
         self.coord_x = coordinates[0]
18
         self.coord_y = coordinates[1]
19
         self.coord_y = coordinates[1]
19
         self.coord_z = coordinates[2]
20
         self.coord_z = coordinates[2]
27
             self.resid = atom.res_seq_nb
28
             self.resid = atom.res_seq_nb
28
             self.res_name = atom.res_name
29
             self.res_name = atom.res_name
29
             self.chain_id = atom.chain_id
30
             self.chain_id = atom.chain_id
31
+            self.insertion_code = atom.insertion_code
30
             
32
             
31
             
33
             
32
     def h_bond(self, res2):
34
     def h_bond(self, res2):

+ 3 - 1
src/pdb.py View File

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

+ 6 - 6
src/structure.py View File

121
                 k+=1
121
                 k+=1
122
                 temp_res.append(residues[i])
122
                 temp_res.append(residues[i])
123
             if(k>2):
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
             i = i+k
126
             i = i+k
127
         else:
127
         else:
128
             i+=1
128
             i+=1
140
                               vectors_substr(position_vector(residues[i+2].atoms["CA"].coords),
140
                               vectors_substr(position_vector(residues[i+2].atoms["CA"].coords),
141
                                              position_vector(residues[i].atoms["CA"].coords)))
141
                                              position_vector(residues[i].atoms["CA"].coords)))
142
         if(angle>70):
142
         if(angle>70):
143
-            print("angle", i+1, angle)
143
+            print("angle", residues[i].resid, angle)
144
     return(bends)
144
     return(bends)
145
 
145
 
146
 def vecteur_deux_points (a, b):
146
 def vecteur_deux_points (a, b):
175
     return vector
175
     return vector
176
 
176
 
177
 def vectors_substr(v1, v2):
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
 def vector_angles(v1,v2):
182
 def vector_angles(v1,v2):
183
     dot_prod = dot_product(v1,v2)
183
     dot_prod = dot_product(v1,v2)