Package MolKit :: Package pdb2pqr :: Package extensions :: Module chi
[hide private]
[frames] | no frames]

Source Code for Module MolKit.pdb2pqr.extensions.chi

 1  """ 
 2      Chi extension 
 3   
 4      Print the backbone chi angle for each residue in the structure. 
 5      Chi angle is determined by the coordinates of the N, CA, CB (if 
 6      available), and CG/OG/SG atoms (if available). 
 7   
 8      Author:  Todd Dolinsky 
 9  """ 
10   
11  __date__ = "17 February 2006" 
12  __author__ = "Todd Dolinsky" 
13   
14  from src.utilities import * 
15  from src.routines import * 
16   
17 -def usage():
18 str = " --chi : Print the per-residue backbone chi\n" 19 str += " angle to {output-path}.chi\n" 20 return str
21
22 -def chi(routines, outroot):
23 """ 24 Print the list of psi angles 25 26 Parameters 27 routines: A link to the routines object 28 outroot: The root of the output name 29 """ 30 31 outname = outroot + ".chi" 32 file = open(outname, "w") 33 34 routines.write("\nPrinting chi angles for each residue...\n") 35 routines.write("Residue chi\n") 36 routines.write("----------------\n") 37 38 # Initialize some variables 39 40 protein = routines.protein 41 42 for residue in protein.getResidues(): 43 if residue.hasAtom("N"): ncoords = residue.getAtom("N").getCoords() 44 else: continue 45 46 if residue.hasAtom("CA"): cacoords = residue.getAtom("CA").getCoords() 47 else: continue 48 49 if residue.hasAtom("CB"): cbcoords = residue.getAtom("CB").getCoords() 50 else: continue 51 52 if residue.hasAtom("CG"): gcoords = residue.getAtom("CG").getCoords() 53 elif residue.hasAtom("OG"): gcoords = residue.getAtom("OG").getCoords() 54 elif residue.hasAtom("SG"): gcoords = residue.getAtom("SG").getCoords() 55 else: continue 56 57 chi = getDihedral(ncoords, cacoords, cbcoords, gcoords) 58 routines.write("%s\t%.4f\n" % (residue, chi)) 59 file.write("%s\t%.4f\n" % (residue, chi)) 60 61 routines.write("\n") 62 file.close()
63