Selecting atoms

Selecting atoms in CNS is performed using a matching operation. This means that an expression is written which is matched against the properties of the atoms currently stored in memory. Those atoms which match the expression are selected.

Selections may be simple, selecting atoms on the basis of residue number for example. However, the creation of more complex expressions requires the combination of one or more simple expressions with the operators AND, OR and NOT. The meaning of these basic operators must be understood for construction of meaningful selection expressions.

OR: The union between the two sets of atoms selected in the two enclosing expressions.

Example:

      (segid A or residue 10)

All atoms which have the segid A OR the residue number 10 are selected. This would select all atoms with the segid A and also any atoms which have the residue number 10.

AND: The intersection between the two sets of atoms selected in the two enclosing expressions.

Example:

      (segid A and residue 10)

All atoms which have the segid A AND the residue number 10 are selected. This would only select those atoms which have both the segid A and the residue number 10.

NOT: All atoms outside the set of atoms selected in the following expression.

Example:

      (not (residue 10))

All atoms which do not have the residue number 10 are selected.

Simple expressions are grouped using parentheses to make clear the order of selection.

Example:

      ((segid A or residue 10) and resname TYR)

This would select any atoms with either segid A or residue number 10, which also have the residue name TYR. This should be compared with:

      (segid A or (residue 10 and resname TYR))

This would select all atoms with segid A, and also any atoms which have residue number 10 and residue name TYR.

Examples

Please see the syntax manual for a full description of the atom selection syntax. Below are some examples which cover many of the common atom selection concepts.

  • Selection of all atoms:
  • Selection of no atoms:
  • Selection of all atoms whose coordinates are known:
  • Selection of all atoms whose coordinates are not known:
  • Selection of all hydrogen atoms (selects all atoms with a mass of 1 AMU):
  • Selection by segid:
  • Selection by range of segids (all atoms with a segid between A and D inclusive are selected):
  • Selection by residue number:
  • Selection by a range of residue numbers (all atoms with their residue number between 10 and 50 inclusive are selected):
  • Selection by residue name (selects all atoms with the name MET):
  • Selection by atom name (selects all atoms with the name CA):
  • Selection by chemical type (selects all atoms with the chemical type ZN):
  • Selection by atom id (should only be used when the id has been returned by a previous show expression or inside a FOR $ID IN ID loop construct):
  • Selection of all atoms in a residue given a subset of atoms unique to that residue:
  • Selection of all atoms bonded to an atom:
  • Selection of one unique atom per residue (the TAG modifier selects only one atom per residue):
  • Selection of all atoms within a specified distance of another atom selection (atoms within 5.0 Å of any atom in the preceeding selection are selected):
  • Selection of all atoms within a specified distance of another atom selection taking into account crystallographic symmetry (atoms within 5.0 Å of any atom or its symmetry mate in the preceeding selection are selected):
  • Atomic attributes

    Selections can also be made on the basis of atomic attributes such as coordinates or B-factors. The ATTRIBUTE operator is used:

    Example:

          (attribute(b > 50))
    

    All atoms which have an atomic B-factor greater than 50 are selected.

    Examples

    Please see the syntax manual for a full description of the attribute syntax and the full set of atomic attributes which can be used for selection. Below are some examples which cover many of the common attribute concepts.

  • Selection of all atoms whose X coordinates are equal to 0:
  • Selection of all atoms whose B-factors are not equal to 0:
  • Selection of all atoms whose masses are greater than 20:
  • Selection of all atoms whose charges are negative:
  • Note that all attribute operators are single character only, there are no such operators as <= or >=. A compound expression must be used instead:

    Example:

          (attribute(b = 50) or attribute(b > 50))
    

    All atoms which have an atomic B-factor greater than or equal to 50 are selected.

    Complex selections

    Selection expressions can be compounded to form more complex expressions.

    Example:

          (attribute(b > 50) and (segid A or residue 10))
    

    All atoms which have an atomic B-factor greater than 50 and segid A or residue number 10 are selected.

    Examples

  • Selection of atoms in the mainchain of a protein:
  • Selection of atoms in a protein which are equivalent to poly-alanine:
  • Selection of atoms other that the mainchain of a protein (i.e. the atoms in the protein sidechains, and any atoms not in protein):
  • Selection of non-hydrogen atoms whose coordinates are known:
  • Selection of non-hydrogen atoms whose coordinates are known which are within a 5 Å radius of residue 10 in segid B:

  • Back to tutorials   Next section