In this example below (from Thomas), the method 'iterate' is used. The 
function saves every amino acid of a structure to a separate file. First 
of all, I'm not sure of how to understand the docs:

" "iterate" iterates over an expression within a temporary namespace for 
each atom."

What does temporary namespace for each atom mean? Also, since 'iterate' 
is used within the while-loop, are we only iterating over the single 
amino acid? Its confusing me because I constantly think of iterate as 
somekind of short hand notation of a for-loop, but I guess thats not it. 
It would be great if somebody could explain the iterate function a bit 
more to me.

Thanks for your feedback.
Martin

# *****************************************************************
# import statements
def seq(state, selection="name ca or resn hoh or resn lig"):
      cmd.select("prot", selection)
      while cmd.pop("_tmp", "prot"):
          cmd.iterate("_tmp", "stored.x=(resn,resv)")
          # 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)
# -----------------------------------------------------------------



------------------------------------------------------------------------------
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