Hi All,

I am script-plowing through PDB files and extracting unique chain identifiers only for "polymers" using PyMOL's polymer selection. Right now my code is a kind of brute force thing like this:
<code>

  cmd.create ("justpolys","polymer")

  polymer_chains=[]

  for a in cmd.index("justpolys"):
    q_sel = "%s`%d"%a
    #print q_sel+":",
    cmd.iterate(q_sel, "stored.qry_info = (chain,resn,resi,name)")
    #cmd.iterate_state(1,q_sel, "stored.qry_xyz = (x,y,z)")
    #print stored.qry_info[0],stored.qry_info[1],stored.qry_info[2],stored.qry_info[3]
    # Track any unique chains by adding to polymer_chains list if not already there
    # first reformat to get rid of flanking ' marks
    thischain=`stored.qry_info[0]`
    thischain=thischain.replace("'","")
    if thischain not in polymer_chains:
      polymer_chains.append(thischain)
</code>

This works, but is quite slow as it iterates over every atom in every pdb just to get out the chain so it is quite redundant. 

Is there any way to iterate in a 'chain by chain' fashion? This q_sel stuff is recycled from something Warren suggested for a different purpose years ago, and I only have a loose idea of how that is interacting with the cmd.index part. Maybe there's a way to get just the chain from the get-go instead of all the individual atoms? Any reminders on that one or better method suggestions?

Thanks,
Seth