Kaynağa Gözat

display helix

Thomas Forest 5 yıl önce
ebeveyn
işleme
d58e01d3f2
3 değiştirilmiş dosya ile 38 ekleme ve 10 silme
  1. 28 4
      src/atom.py
  2. 8 4
      src/dssp.py
  3. 2 2
      src/structure.py

+ 28 - 4
src/atom.py Dosyayı Görüntüle

@@ -167,8 +167,8 @@ class Residue:
167 167
             return False
168 168
         
169 169
         if(self.get_turns(residues) and residues[i-1].get_turns(residues)):
170
-            print(self.get_turns(residues).turn_type,"- HELIX at", residues[i].resid)
171
-            return(self.get_turns(residues).turn_type, residues[i].resid)
170
+            #print(self.get_turns(residues).turn_type,"- HELIX at", residues[i].indice)
171
+            return(self.get_turns(residues).turn_type, residues[i].indice)
172 172
         return(False)
173 173
 
174 174
     def get_ladder(self, residues):
@@ -470,14 +470,38 @@ def build_turns_patterns(residues):
470 470
             for k in range(turn.turn_type):
471 471
                 if turn.turn_type == 3:
472 472
                     turns_3[i+1+k] = turn.turn_type
473
-                    #print(i+1+k, turn.turn_type)
474 473
                 if turn.turn_type == 4:
475 474
                     turns_4[i+1+k] = turn.turn_type
476
-                    #print(i+1+k, turn.turn_type)
477 475
                 if turn.turn_type == 5:
478 476
                     turns_5[i+1+k] = turn.turn_type
479 477
     return[turns_3, turns_4, turns_5]
480 478
 
479
+def build_helix_patterns(residues):
480
+    helix_3 = {}
481
+    helix_4 = {}
482
+    helix_5 = {}
483
+    for i,res in enumerate(residues):
484
+        helix = residues[i].get_helix(residues)
485
+        if(helix):
486
+            helix_type = residues[i].get_helix(residues)[0]
487
+            helix_pos = residues[i].get_helix(residues)[1]
488
+            #print("TYPE", helix_type)
489
+            for k in range(helix_type):
490
+                if helix_type == 3:
491
+                    helix_3[i+1+k] = "G"
492
+                if helix_type == 4:
493
+                    helix_4[i+1+k] = "H"
494
+                if helix_type == 5:
495
+                    helix_5[i+1+k] = "I"
496
+        #print(helix_3)
497
+    return[helix_3, helix_4, helix_5]
498
+
499
+def print_helix_pattern(residues, res, helix):
500
+    i = residues.index(res)+1
501
+    if i in helix.keys():
502
+        return (helix[i])
503
+    else:
504
+        return(' ')
481 505
 
482 506
 def print_turn_pattern(residues, res, turns):
483 507
     i = residues.index(res)+1

+ 8 - 4
src/dssp.py Dosyayı Görüntüle

@@ -59,11 +59,10 @@ residues = pdb_file.residues
59 59
 bridges = get_bridges(residues)
60 60
 ladders = get_ladders(bridges, residues)
61 61
 sheets = get_sheets(ladders)  
62
-
62
+helix = build_helix_patterns(residues)
63 63
 # iterating over residues
64 64
 for i,res in enumerate(residues):
65 65
     #res.get_turns(residues, turns)
66
-    #res.get_helix(residues)
67 66
     kappa = res.get_bends(residues)[0]
68 67
     bend_symbol = res.get_bends(residues)[1]
69 68
     t_co = res.get_tco(residues)
@@ -78,5 +77,10 @@ for i,res in enumerate(residues):
78 77
     turn_3 = print_turn_pattern(residues, res, turns[0])
79 78
     turn_4 = print_turn_pattern(residues, res, turns[1])
80 79
     turn_5 = print_turn_pattern(residues, res, turns[2])
81
-    print(i+1, res.resid, res.chain_id, res.res_letter, turn_3, turn_4, turn_5, bend_symbol, chirality, round(t_co, 3), round(kappa,1),
82
-          round(alpha, 1), round(phi, 1), round(psi,1), round(x_ca,1), round(y_ca,1), round(z_ca,1))
80
+
81
+    helix_3 = print_helix_pattern(residues, res, helix[0])
82
+    helix_4 = print_helix_pattern(residues, res, helix[1])
83
+    helix_5 = print_helix_pattern(residues, res, helix[2])
84
+    
85
+    print(i+1, res.resid, res.chain_id, res.res_letter, helix_3, helix_4, helix_5, turn_3, turn_4, turn_5, bend_symbol, chirality, round(t_co, 3), round(kappa,1),
86
+           round(alpha, 1), round(phi, 1), round(psi,1), round(x_ca,1), round(y_ca,1), round(z_ca,1))

+ 2 - 2
src/structure.py Dosyayı Görüntüle

@@ -24,8 +24,8 @@ class Bridge(Structure):
24 24
 
25 25
 class Helix(Structure):
26 26
 
27
-    def __init__(self, residues, res_num):
27
+    def __init__(self, residues, res_num, helix_type):
28 28
         self.residues = residues
29 29
         self.res_num = res_num
30 30
         Structure.res = res_num
31
- 
31
+        self.helix_type = helix_type