next up gif contents index
Next: Complex Queries Up: Command Language Previous: Actions

 

Selection

    Spock has a sophisticated atom selection feature, allowing for the creation of complex queries. The individual query elements can be nested, and boolean ``and'' and ``or'' operations applied. Curly braces ``{'' and ``}'' can be used to group elements to change the order of operations. Various numerical relationships can be indicated by the symbols ``='' (equals), ``<>'' (not equals), ``>'' (greater than), ``<'' (less than), ``>= or =>'' (greater than or equals) and ``<= or =<'' (less than or equals). For strings, only the ``='' and ``<>'' relations are valid. The exact syntax used to combine query elements will be described in §5.4, after the simple query elements have been introduced. A few definitions are necessary in order to understand the syntax of the simple queries.

For RANGEs and LISTs only equals (``='') and not equals(``<>'') are valid relationships, e.g. rn<>[1,2,3] or an=(1,2).

Note: As a typographic convention, in the manual, a construct like ``<RANGE|LIST|NUMBER>'' indicates that a RANGE, or LIST or NUMBER may be used, but the angle brackets and vertical bar are not a part of the expression. For a LIST, however, the square brackets are a required part of the expression.  

Atom/Residue Numbering

  Perhaps the most common types of selections are based on the atom and residue numbering. The commands take the form of: The reason for the difference between pdban and an is that spock assigns a sequential number for each atom it reads, and each atom is uniquely identified by this number. If there is more than one file read in, the first atom of the second file will not have an=1, but rather, the an will be one greater than the last atom of the first file. In each, case, the pdban is the number assigned to the atom by the PDB file. Further, if there are missing residues in the PDB file, PDB atom numbers may be missing. There are no corresponding gaps in the an field. Several different atoms may have the same pdban.

Examples:

 

Atom, Residue, Chain, Altloc, Icode and Subset Names:

  You can also select groups of atoms by the atom, residue, chain, or subset name. Spock follows PDB naming conventions in that atoms have names that are four characters long, residues (and bases) have names of three characters, and chains have 1 character identifiers. The commands are:     Spock string comparisons for selections are in all cases converted to upper case before comparison. Note that spock has two modes of string comparison, ``strict'' and ``loose''. Loose is the default which means that spaces are ignored, and the wildcards ``?'' and ``$'' are supported (see below). Further, in loose mode, spock simply checks to see if the query string is contained in the internal name. Therefore ``C'' would match ``CA'' and ``CB''. If you want to match only atoms named ``C'' you must use strict comparisons, in which the strings must match exactly, with the exceptions that spaces are represented on the command line by the underscore character ``_'', and all strings are converted to upper case. The correct query string would then be ``_C__''. An underscore character in the query string tells spock to use strict comparison, otherwise it uses loose string comparison.   In order to use the wildcards ``?'' and ``$'' you must use quotes around the string. The question mark stands for any single character and the dollar sign stands for any ending. For example, r="AS?" will match ASP and ASN, while r="A$" will match ALA, ASP, ASN, ARG, and so on. For a quoted comparison of this type, you may use spaces, underscores are not necessary. Using quotes does not imply strict comparison. For instance r="AL" will match both ALanine and vALine.

Examples:

 

Atom properties

  Spock can also select groups of atoms based on the atom properties fields, such as: charge, distance, surface area, radius, etc., and vertices based on vertex property fields, such as: vertex charge, vertex color, distance, etc. The commands are shown below:

The ``distance'' and ``distance partner'' properties will be explained fully in §6.6.1. For now it will suffice to know that spock is able to calculate the distance between two sets of atoms and store the minimum distance (on a per-atom basis) in the distance property. This distance is the distance to some other atom, called the distance partner. The atom number of the distance partner is stored in the dp field.   The bcnt and hbcnt options are most useful with the projection syntax described in § 5.4.1. With these properties, you can, for instance, hide all residues which don't have any hydrogen bonds. The command bc=0,bcnt=0 is also useful, in that it will turn off the ``cross'' representation of non-bonded atoms, such as waters or metal ions.     Note that there are two types of ``action commands'' §5.2 in spock--those that apply to atoms, worms, and the like, and those that apply to surfaces. Since each vertex in a surface is associated with an atom (it's ``owner'') it makes sense to apply atom selections to vertices. For example, the command vc=9,r=ala will color all surface vertices ``owned'' by alanine residues with color 9. To repeat, any atom selection will be mapped to the appropriate vertices. However, going the other way does not make sense, and is not allowed. For instance, the command bc=0,vp>0, and attempt to hide bonds associated with vertices with a positive potential is not allowed, and will fail. It's likely that any given atom has several vertices associated with it, and there's no logical way to determine which of the several vertices should be used to determine the outcome of the comparison. Using vertex selections on vertex actions is fine, of course. To summarize, you can use atom selections with atom actions, ``promote'' atom selections to apply to vertices, or use vertex selections on vertices. The valid vertex actions are vc, set vp, set vp1, set vp2, and set vdistance.   The coordinate selection commands are particularly useful, as they can quite quickly help to eliminate unwanted objects from the display. The untransformed selections x,y,z,vx,vy and vz are straightforward, the selection string selects based on the value of the given coordinate in the world coordinate frame. The transformed selections are quite different, however. Imagine the viewing volume on the screen to be a cube centered at {0,0,0} and ranging from -1 to +1 in each dimension. It is this coordinate frame that the transformed selection commands use. For instance bc=0,X>0 would hide all bonds on the right half of the screen, no matter what the current viewing transformation. These commands are particularly useful with surfaces, as they allow you to clip away the front part of a surface with ease. For instance, with a surface defined, vc=0,vZ>0 will clip away the front half of the surface. As above, atom coordinate selections applied to a vertex action is permissible, the atom selection will be promoted to the vertices, but the reverse is not possible.  

Selection by object or molecule number

    Spock can also select by object or molecule number. Each molecule read in is given a unique number, and the list of molecules is displayed after the file is read, or one can be generated via a mlist command. Similarly, each defined helix, sheet and turn is given a number, which can be used to select.  The negation of the helix, sheet and turn selections is not immediately obvious. Since the hn=1 command selects all atoms in helix 1, should hn<>1 select all atoms not in helix 1, or should it select all atoms in helices which are not numbered 1? Spock takes the latter choice, since the user is selecting on helix, or sheet or whatever. Therefore, bc=1,hn<>3 will only color helices that aren't numbered 3, not all atoms that aren't in helix 3. More information about helix and sheet commands is given in §6.4.8 and 6.4.9.

Examples:

 

Selecting on color

   The color properties can also be used to select groups of atoms. Here it is important to remember the ``Action, Selection'' order, because the same string is used to select on atom color as to set the atom color. You can, of course, specify a coloring action and a color-based selection, in fact, you may often want to do this to change objects colored with one color to another color, as in the first example below.

Examples:


next up gif contents index
Next: Complex Queries Up: Command Language Previous: Actions

Jon Christopher
Tue Sep 14 16:44:48 CDT 1999