Dear PyMOL List
It comes up once in a while, is it possible to use PyMOL features from 
outside of PyMOL? An example, the below is a script (inspired by Thomas 
Holder) which saves down to disk all amino acids of a protein structure 
into separate PDB files.

# *****************************************************************
from pymol import cmd
from pymol import stored
from pymol.exporting import _resn_to_aa as one_letter
# *****************************************************************
def seq(state, selection="name ca or resn hoh or resn lig"):
     print "Generating seqs."
     cmd.select("prot", selection)
     while cmd.pop("_tmp", "prot"):
         cmd.iterate("_tmp", "stored.x=(resn,resv)")
         #print stored.x[0], stored.x[1]

         # Special case 1: Waters.
         if stored.x[0] == 'HOH':
             filename = 'seq-x%s-%s.pdb' % (stored.x[1], state)
         # Special case 2: Substrate.
         elif stored.x[0] == 'LIG':
             filename = 'seq-x%s-%s.pdb' % (stored.x[1], state)
         # Other: protein back-bone.
         else:
             filename = 'seq-%s%d-%s.pdb' % (one_letter[stored.x[0]].lower(), 
stored.x[1], state)
         cmd.save(filename, "byres _tmp")
     cmd.delete('_tmp prot')

cmd.extend('seq', seq)
# -----------------------------------------------------------------

Is it possible to somehow include this in a Python script, and running 
it from the command line? If not, why?


Thanks for any feedback.



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to