Selector Construction Panel

The Selector Construction Panel is opened when Select... Construct Selector is chosen from the menu. This panel is used to construct custom selectors, either for immediate use or for later invocation from the Select menu.

Whatever is selected in the main Chimera window is always available as the special selector named "Existing selection".

To facilitate constructing new selectors, the selector panel has the concept of a "current" selector and a "workbench" selector. The current selector is chosen via the "Selector list" menu button just below the menubar. The workbench selector is a scratch selector that can be edited textually or operated upon with boolean operators (with the current selector as the other operand). The workbench selector can be saved into the selector list as desired.

Interface Components

"Selector" pull-down menu

The leftmost menu in the menubar that spans the top of the selector panel is the "Selector" menu. The items of the menu are used to move or delete selectors. Only selectors created by you can be moved or deleted. The items are:

Rename
Change the name of the current selector.
Delete
Excise the current selector.
Delete Menu...
Delete a category of selectors contained in a submenu. A dialog will pop up to obtain specifics about what to delete and to confirm the deletion.

"Workbench" pull-down menu

The middle menu in the menubar is the "Workbench" menu. The items of the menu are used to perform actions on/with the workbench selector. The items are:

Load from current
The contents of the current selector are loaded into the workbench selector.
Save...
The workbench selector is saved into the selector list. A dialog comes up to query for the new selector name and what submenu (if any) to place it under.

"Panels" pull-down menu

The rightmost menu in the menubar is the "Panels" menu. The items of the menu are checkbuttons that control whether the contents of the workbench and current selectors are displayed. If displayed, they will be shown in their own individual panels. A selector's content is typically Python code. The content can instead be an OSL string, but there is rarely any call for this, since OSL selectors are more restrictive than the "Midas atom specifier" selector. The workbench selector panel is editable. See the Python Selectors section for details of how Python-code selectors work.

Selector list menu

Directly below the menubar is a menu of all available selectors. Related selectors may be grouped together and made available as a submenu of the selectors menu. The menu button shows the currently chosen selector. If the current selector is in a submenu, only the non-submenu component is shown on the menu button. The full menu path of the selector is always shown in the Status area near the bottom of the selector panel. The selector "Existing selection" always contains whatever is currently selected in the main Chimera window.

One of the selectors in the main list is "Midas atom specifier". Choosing this will bring up a panel in which a Midas atom specifier can be entered. Once an atom spec is entered, this selector is used the same as any other selector for purposes of workbench construction and so forth. Note that it isn't the same as the "Midas atom specifier" menu item/panel in the Chimera "Select" menu; entering an atom spec in one panel has no effect on the other.

"Select" area

Below the selectors menu button is the "Select" area. Buttons in this area are used to select items in the main Chimera window. The "Current" button uses the current selector to select items whereas the "Workbench" button uses the workbench selector. The "Internal bonds" button adds to the selection any bonds that have both endpoint atoms selected.

"Workbench" area

Below the Select area is the "Workbench" area. Buttons in this area perform operations on the workbench selector.

The "Zone..." button brings up a dialog in which to specify a "selection zone". This selection zone is specified as an angstrom distance from the atoms/bonds currently selected by the workbench selector. The zone may be specified either as all atoms/bonds further away than the distance or (the more frequent case) closer than the distance. The end result is that the workbench selector selects atoms/bonds in the selection zone. If the zone is of the "further away" type, the selection won't include the atoms upon which the zone definition was originally based.

The "Clear" button clears the workbench.

The "Operations" button brings up a menu for performing various operations on the workbench selector. The menu contains:

Select internal bonds
Similar to "Internal bonds" button in Select area.
Union with current
Union with the current selector.
Intersect with current
Intersect with the current selector.
Workbench - current
Subtract the current selector from the workbench selector.
Current - workbench
Subtract the workbench selector from the current selector, and put the result in the workbench selector.

"Status" area

The status area displays the name of the current selector.

Python Selectors

This section assumes you are familiar with the basics of writing Python code. If you are not, consult the Python tutorial.

When the Python code of a selector is executed, certain useful local variables are "pre-set" for use in the selector. They are:

models
All models currently open in Chimera, including non-molecular models.
molecules
All molecules currently open in Chimera.
sel
An empty ItemizedSelection (see the selection module). The selector is expected to populate this ItemizedSelection with the proper selected items.
sels
A list that is used as a stack when doing compositing operations such as the intersection or union of selectors. Typically ignored when creating simple selectors. Nonetheless, don't use the name for other purposes.
selection
A reference to chimera.selection, for convenience.