[Chimera-users] pdb parsing problem-- hydrogen as mercury

Eric Pettersen pett at cgl.ucsf.edu
Fri Feb 18 14:32:51 PST 2005


Hi Josh,
	There's a short Python script at the end of this message that produces 
a fixed PDB file.  If there is an 'H' in the problem column and the 
atom name is four characters long ending in a digit, it will switch the 
fourth character of the name around to the front.  The scripts expects 
the problem file name as a command-line argument and prints the 
corrected file to standard output.  Hope this helps...

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu
                         http://www.cgl.ucsf.edu

--- script ---
#!/bin/env python

import sys
pdbFile = file(sys.argv[1], "rU")
for line in pdbFile:
         if (line.startswith("ATOM  ") or
         line.startswith("HETATM")) and line[12] == "H" and 
line[15].isdigit():
                 print line[:12] + line[15] + line[12:15] + line[16:],
         else:
                 print line,
pdbFile.close()



More information about the Chimera-users mailing list