Using Expressions
When you want to select a number of items,
interactive selection can be very
cumbersome, especially in large molecules. MOLMOL allows
you to select items using a powerful expression syntax.
You can interpret these expressions as rules that an
item has to satisfy to get selected.
You can use commands like SelectAtom to
select items, but it is normally much more convenient
to use the Selection Dialog that
can be opened by clicking the Selection button on
the right side of the main window.
This section gives an informal introduction into
selection expressions, a more complete and precise
description can be found in the section
Expression Syntax.
Short Notation
While the full expression syntax is necessary for complex
selections, a more compact notation is supported to make
simple selections easier. In this short notation, the
expression consists of three parts, all of which are
optional:
- the character # followed by a list of molecule
names and numbers
- the character : followed by a list of residue
names and numbers
- the character @ followed by a list of atom names
Spaces are not allowed within such an expression. Lists of
names and numbers, separated by commas, are allowed, as well
as ranges of numbers, denoted by the - (minus)
character. It is possible to give a list of such expressions,
separated by spaces, this will select all parts.
The following are some examples of this short notation used
for selecting atoms:
- @CA
- all atoms named CA
- :10-20
- all atoms in residues number 10 to 20
- #1-3,5:10-20,25,LYS@N,CA,C
- all atoms named N, CA or C in residues number 10 to 20
residue number 25, and residues named LYS, in molecules
number 1 to 3 and 5
- :10@HN :17@HA
- atom named HN in residue number 10 and atom named HA
in residue number 17
Selecting Everything/Nothing
Giving an empty string as selection expression selects
all items. The expression '0' (a string with
the digit zero as the only character) will deselect
everything.
Full Expression Syntax
The full expression syntax of MOLMOL is very similar to
expressions in a programming language like C. A number
of values, e. g. charge
for the charge of an atom or len for the
length of a bond, and boolean properties,
like bb for backbone, are available for each
item. These can be arbitrarily combined with arithmetic
and logical operators. The result of the expression must
be a boolean value, all items for which the expression
evaluates to true are selected.
The following are some examples of the full notation used
for selecting atoms:
- name = "CA" & bfactor > 3.2
- atoms with name CA and B factor larger than 3.2
- vdw < 1.5 | charge > 0.0
- atoms with VdW radius less than 1.5 or a positive
partial charge
Last modified: Mon Jan 20 19:44:56 CST 2003
Reto Koradi, kor@mol.biol.ethz.ch