next up previous contents index spock_search.gif
Next: The Command-line Calculator: Up: Command Language Previous: Selection

Subsections


          
Complex Queries

The simple selection queries detailed above can be combined to create complex expressions. The simplest method of combination is a simple comma separating the two parts, which is treated as a logical ``and'', so the final selection must satisfy both parts of the expression. For example: bc=1,rn=(1,10),a=ca will color bonds 1 only for alpha carbons in residues 1-10. Instead of a comma, the C ``and'' operator ``&&'' may also be used to create logical ``and'' constructs. The C ``or'' operator ``||'' is also allowed to create expressions that match one component or the other, e.g. a=ca||a=cb selects atoms named ``CA'' or atoms named ``CB''. Finally, the English words ``and'' and ``or'' are also recognized. If you use the English words, however, they must be separated from the rest of the command by spaces, e.g. r=ala and a=ca. Evaluation of expressions is normally carried out in a left-to right fashion, but curly braces may be used to control the order of operations. The ``&&'' and ``||'' operators have the same precedence, so it is usually a good idea with complex expressions to specify the grouping explicitly.

Examples:

Note that the innermost set of braces is evaluated first. Occasionally, when working with a long LIST of items, spock may complain that the list generates too long of an expression. This is because the LIST structure (rn=[1,3,5,7]) is internally translated into an ``OR'' based construct (rn=1||rn=3||rn=5||rn=7). This may occasionally generate a string that is too long for the internal buffers. A work-around for this is to simplify the part of the expression using a subset, and then include the subset as part of the selection scheme. Say the string above was part of a larger expression that proved to be too long. You could use a subdef=temp,rn=[1,3,5,7] and then replace that part of the expression with sub=temp. See § 6.8 for more details on subsets.

    
Projection

The final feature of spock's selection syntax is ``projection''. Spock can project selections onto either atoms or entire molecules. This means that if any atom in a residue is selected, the entire residue gets selected for residue projection, or if any atom in a molecule is selected the entire molecule is selected in molecule projection. The syntax for projection is to surround the selection with parentheses and add ->r to the command for residue projection, or ->m for molecule projection. For example, bc=3,{q>0}->r will color all bonds in residues that have any charged atom with color 3. There can be more than one selection string in the parentheses: e.g. bc=0,{q>0||d>0}->r, which will hide all bonds for residues which have any atom with a charge or distance property greater than 0. This is a hideously ugly syntax, I know, but it does prove to be quite useful, particularly in conjunction with the ``Projected Command'' option of the Picking menu §6.9.1.


next up previous contents index spock_search.gif
Next: The Command-line Calculator: Up: Command Language Previous: Selection
Jon Christopher
2004-02-19