/usr/share/pdb2pqr/extensions/chi.py is in pdb2pqr 2.1.1+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | """
Chi extension
Print the backbone chi angle for each residue in the structure.
Chi angle is determined by the coordinates of the N, CA, CB (if
available), and CG/OG/SG atoms (if available).
Author: Todd Dolinsky
"""
__date__ = "17 February 2006"
__author__ = "Todd Dolinsky"
from src.utilities import getDihedral
def usage():
return 'Print the per-residue backbone chi angle to {output-path}.chi'
def run_extension(routines, outroot, options):
"""
Print the list of psi angles
Parameters
routines: A link to the routines object
outroot: The root of the output name
options: options object
"""
outname = outroot + ".chi"
outfile = open(outname, "w")
routines.write("\nPrinting chi angles for each residue...\n")
routines.write("Residue chi\n")
routines.write("----------------\n")
# Initialize some variables
protein = routines.protein
for residue in protein.getResidues():
if residue.hasAtom("N"):
ncoords = residue.getAtom("N").getCoords()
else:
continue
if residue.hasAtom("CA"):
cacoords = residue.getAtom("CA").getCoords()
else:
continue
if residue.hasAtom("CB"):
cbcoords = residue.getAtom("CB").getCoords()
else:
continue
if residue.hasAtom("CG"):
gcoords = residue.getAtom("CG").getCoords()
elif residue.hasAtom("OG"):
gcoords = residue.getAtom("OG").getCoords()
elif residue.hasAtom("SG"):
gcoords = residue.getAtom("SG").getCoords()
else:
continue
chi = getDihedral(ncoords, cacoords, cbcoords, gcoords)
routines.write("%s\t%.4f\n" % (residue, chi))
outfile.write("%s\t%.4f\n" % (residue, chi))
routines.write("\n")
outfile.close()
|