There are a number of different ways to do this, but the easiest is:
obj_name = cmd.identify('pk1',1)[0][0]
To be safe, your code should probably make sure that the selection pk1
exists and contains at least one atom:
obj_name = None
if 'pk1' in cmd.get_names('selections'):
if cmd.count_atoms('pk1',1):
obj_name = cmd.identify('pk1',1)[0][0]
if obj_name:
# do something here...
Cheers,
Warren
--
mailto:[email protected]
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
> -----Original Message-----
> From: Ezequiel Panepucci [mailto:[email protected]]
> Sent: Wednesday, November 14, 2001 4:30 PM
> To: [email protected]
> Subject: [PyMOL] molecule name from PK* selections
>
>
> Hello,
> Is there a way to get the corresponding molecule (or model)
> name for a given PK1 selection?
> Thanks,
> Zac
>
>
>
> _______________________________________________
> PyMOL-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymol-users
>