Ben, 

   If all you have is a single structure loaded, then you can get
unambiguous identifiers corresponding to the atom positions in the
macromodel file by cmd.identify.

For example, if the user put some atoms into the "lb" selection using
the mouse, then you could get a Python list of their indices as follows:

print cmd.identify("(lb)")

[1,4,7,8,4,50]

(one based atom indices from the macromodel file).

Example usage with a Python function...

from pymol import cmd

def color_sele_red(sele):
   lst = cmd.identify(sele)
   cmd.color("white")
   for a in lst:
      cmd.color("red","(id %d)"%a)

color_sele_red("lb")
      
Note that if you have multiple objects loaded, you will need some way of
determining which identifiers correspond in which object.  Right now
that is complicated.  In version 0.67, you can pass a mode argument to
"identify" which will give you the object names and identifiers as a
list of tuples...

print cmd.identify("(lb)")

[('pept',2),('pept',6),('pept',11)]

It is also possible to grab user selections directly with the Wizard
capabilities.  That interface isn't documented, but several working
examples exist:

pymol/modules/pymol/wizard/*.py

Cheers,
Warren

Ben Wrote:

>Let me help break the new mailing list in.  I haven't been using pymol
>for very long, but I've been impressed with some of its features and
>with its potential.  At the moment, I'm working on a program that
>could benefit by integrating pymol.  Specifically, I need to be able
>to read in a molecule (macromodel format) and allow the user to select
>various atoms.  Does pymol provide a way for my code to access these
>selections? Thanks.

-- 
mailto:war...@sunesis.com 
Warren L. DeLano, Ph.D. 
Informatics Scientist 
Sunesis Pharmaceuticals, Inc. 
341 Oyster Point Blvd. 
S. San Francisco, CA 94080 
(650)-266-3606 fax: (650)-266-3501 

Reply via email to