Tina,
Use the Python in operator
selection-name in cmd.get_names(selections)
PyMOLprint foo in cmd.get_names(selections)
False
PyMOLselect foo, all
Selector: selection foo defined with 1631 atoms.
PyMOLprint foo in cmd.get_names(selections)
True
Cheers,
Warren
--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154
Fax (650)-593-4020
-Original Message-
From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
ad...@lists.sourceforge.net] On Behalf Of Tina Li
Sent: Monday, December 01, 2003 11:50 AM
To: pymol-users@lists.sourceforge.net
Subject: [PyMOL] detecting the existence of a selection
Hello,
I wonder if there is a quick and simple way of detecting whether a
selection
exists without triggering any errors. e.g. to check if there are
currently
any
atoms picked (and collect the residue IDs if there is any), I do:
cmd.iterate((lb),stored.list.append((resi)))
if no atoms were picked, I would see the alarming error messages:
Selector-Error: Unknown keyword or selection.
Selector-Error: Malformed selection.
( ( lb--
Is it possible to suppress them and still get the result?
Thanks in advance!
Tina
---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
___
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users