Hi Seth, So you just want to have all unique chain identifiers for the 'polymer' selection? Does the following give what you want?:
polychains = set([i.chain for i in cmd.get_model('polymer')]) Hope it helps, Tsjerk On Sun, Jan 23, 2011 at 10:04 AM, Seth Harris <set...@gmail.com> wrote: > 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 > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > 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 > -- Tsjerk A. Wassenaar, Ph.D. post-doctoral researcher Molecular Dynamics Group * Groningen Institute for Biomolecular Research and Biotechnology * Zernike Institute for Advanced Materials University of Groningen The Netherlands ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ 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