WriteSS: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 46: | Line 46: | ||
[[Category:Script_Library]] | [[Category:Script_Library|Write SS]] |
Revision as of 18:43, 5 November 2007
Overview
This script will write the secondary structural elements for each PDB file in some specified directory, for each alpha carbon in the protein, to an output text file. Residues without secondary structure definition will get a "." in the string.
This is untested code and has little chance of working for anyone but me. Although, it does work for me.
Instructions
- Copy the code to your machine
- Find FIXME in the code below and change "files" to either a glob like the one already there (for a whole directory) or a list with one element (for just one file).
- change the output filename. By default it's PDBCODE.ss.
The Code
import os;
import os.path;
import glob;
import string;
from pymol import cmd
from pymol import stored
from pymol import selector
files = glob.glob("/tmp/thy_model/*.pdb")
for file in files:
pdbName = string.split(os.path.basename(file), ".")[0]
cmd.load(file, pdbName)
outFile = open(pdbName + '.ss', 'wb')
stored.ss = ""
cmd.iterate( '(n. CA)', 'stored.ss = stored.ss + ("%1s"%ss)')
for c in stored.ss:
if c == " ":
outFile.write('.')
else:
outFile.write(c)
cmd.delete(pdbName)
outFile.close()
Example
python ss.pym # my directory has 1d7p.pdb in it
output for 1D7P.pdb:
...............HHH.......SSS..SSSHHHHH..................................................................SS..SS..................................................