Turns pattern display

master
Thomas Forest 2019-09-18 14:32:37 +02:00
parent 651f01f626
commit 3b73eb5866
2 changed files with 44 additions and 5 deletions

View File

@ -88,10 +88,11 @@ class Residue:
position_vector(residues[i-2].atoms["CA"].coords)),
vectors_substr(position_vector(residues[i+2].atoms["CA"].coords),
position_vector(residues[i].atoms["CA"].coords))))
return angle
if(angle>70):
return [angle, 'S']
return [angle, '']
else:
return 360.0
return [360.0, '']
def get_bridges(self, residues):
bridges = {}
@ -457,3 +458,35 @@ def get_TCO(res1, res2):
res2.atoms["O"].coords)
angle = vector_angles(CO_res1, CO_res2)
return(math.cos(angle))
def build_turns_patterns(residues):
turns_3 = {}
turns_4 = {}
turns_5 = {}
for i,res in enumerate(residues):
turn = residues[i].get_turns(residues)
if(turn):
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 print_turn_pattern(residues, res, turns):
i = residues.index(res)+1
if i in turns.keys() and not i-1 in turns.keys():
return(">")
elif i in turns.keys() and i-1 in turns.keys():
return(turns[i])
elif i not in turns.keys() and i-1 in turns.keys():
return("<")
else:
return(' ')

View File

@ -64,13 +64,19 @@ sheets = get_sheets(ladders)
for i,res in enumerate(residues):
#res.get_turns(residues, turns)
#res.get_helix(residues)
kappa = res.get_bends(residues)
kappa = res.get_bends(residues)[0]
bend_symbol = res.get_bends(residues)[1]
t_co = res.get_tco(residues)
alpha = res.get_chirality(residues)[0]
chirality = res.get_chirality(residues)[1]
phi = res.get_phi_psi(residues)[0]
psi = res.get_phi_psi(residues)[1]
x_ca = res.atoms["CA"].coord_x
y_ca = res.atoms["CA"].coord_y
z_ca = res.atoms["CA"].coord_z
print(i+1, res.resid, res.chain_id, res.res_letter, round(t_co, 3), round(kappa,1),
turns = build_turns_patterns(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))