phi_psi.py¶

Calculates Phi, Psi dihedral angles of a given input PDB structure
USAGE:
python phi_psi.py 2gb1.pdb

Categories:¶

• core/calc/structural/evaluate_phi; core/calc/structural/evaluate_psi

Program source:¶

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 import sys sys.path.append('../../../../../bin/') from pybioshell.core.data.io import Pdb from pybioshell.core.calc.structural import evaluate_phi, evaluate_psi if len(sys.argv) < 2 : print(""" Calculates Phi, Psi dihedral angles of a given input PDB structure USAGE: python phi_psi.py 2gb1.pdb CATEGORIES: core/calc/structural/evaluate_phi; core/calc/structural/evaluate_psi KEYWORDS: PDB input; dihedral angles IMG: Toluen_dihedral_flat_angle.png """) sys.exit() factor = 180.0/3.14159 structure = Pdb(sys.argv[1],"",False).create_structure(0) for code in structure.chain_codes() : chain = structure.get_chain(code) n_res = chain.count_aa_residues() for i_res in range(1,n_res-1) : try : r = chain[i_res] r_prev = chain[i_res-1] r_next = chain[i_res+1] phi = evaluate_phi(r_prev,r) psi = evaluate_psi(r,r_next) print("%d %s %c %7.2f %7.2f" % (r.id(), r.residue_type().code3, r.owner().id(),phi*factor, psi*factor)) except : print("can't evaluate Phi/Psi at position",i_res, file=sys.stderr)