display helix

master
Thomas Forest 2019-09-18 15:36:06 +02:00
parent 3b73eb5866
commit d58e01d3f2
3 changed files with 38 additions and 10 deletions

View File

@ -167,8 +167,8 @@ class Residue:
return False
if(self.get_turns(residues) and residues[i-1].get_turns(residues)):
print(self.get_turns(residues).turn_type,"- HELIX at", residues[i].resid)
return(self.get_turns(residues).turn_type, residues[i].resid)
#print(self.get_turns(residues).turn_type,"- HELIX at", residues[i].indice)
return(self.get_turns(residues).turn_type, residues[i].indice)
return(False)
def get_ladder(self, residues):
@ -470,14 +470,38 @@ def build_turns_patterns(residues):
for k in range(turn.turn_type):
if turn.turn_type == 3:
turns_3[i+1+k] = turn.turn_type
#print(i+1+k, turn.turn_type)
if turn.turn_type == 4:
turns_4[i+1+k] = turn.turn_type
#print(i+1+k, turn.turn_type)
if turn.turn_type == 5:
turns_5[i+1+k] = turn.turn_type
return[turns_3, turns_4, turns_5]
def build_helix_patterns(residues):
helix_3 = {}
helix_4 = {}
helix_5 = {}
for i,res in enumerate(residues):
helix = residues[i].get_helix(residues)
if(helix):
helix_type = residues[i].get_helix(residues)[0]
helix_pos = residues[i].get_helix(residues)[1]
#print("TYPE", helix_type)
for k in range(helix_type):
if helix_type == 3:
helix_3[i+1+k] = "G"
if helix_type == 4:
helix_4[i+1+k] = "H"
if helix_type == 5:
helix_5[i+1+k] = "I"
#print(helix_3)
return[helix_3, helix_4, helix_5]
def print_helix_pattern(residues, res, helix):
i = residues.index(res)+1
if i in helix.keys():
return (helix[i])
else:
return(' ')
def print_turn_pattern(residues, res, turns):
i = residues.index(res)+1

View File

@ -59,11 +59,10 @@ residues = pdb_file.residues
bridges = get_bridges(residues)
ladders = get_ladders(bridges, residues)
sheets = get_sheets(ladders)
helix = build_helix_patterns(residues)
# iterating over residues
for i,res in enumerate(residues):
#res.get_turns(residues, turns)
#res.get_helix(residues)
kappa = res.get_bends(residues)[0]
bend_symbol = res.get_bends(residues)[1]
t_co = res.get_tco(residues)
@ -78,5 +77,10 @@ for i,res in enumerate(residues):
turn_3 = print_turn_pattern(residues, res, turns[0])
turn_4 = print_turn_pattern(residues, res, turns[1])
turn_5 = print_turn_pattern(residues, res, turns[2])
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),
round(alpha, 1), round(phi, 1), round(psi,1), round(x_ca,1), round(y_ca,1), round(z_ca,1))
helix_3 = print_helix_pattern(residues, res, helix[0])
helix_4 = print_helix_pattern(residues, res, helix[1])
helix_5 = print_helix_pattern(residues, res, helix[2])
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),
round(alpha, 1), round(phi, 1), round(psi,1), round(x_ca,1), round(y_ca,1), round(z_ca,1))

View File

@ -24,8 +24,8 @@ class Bridge(Structure):
class Helix(Structure):
def __init__(self, residues, res_num):
def __init__(self, residues, res_num, helix_type):
self.residues = residues
self.res_num = res_num
Structure.res = res_num
self.helix_type = helix_type