User Tools

Site Tools


selection:macros

Atom Selection Macros

Atom selection macros save typing when specifying complex selections. Instead of

my_prot and chain A and resi 10-50 and name CA

or even

my_prot & c. A & i. 10-15 & n. CA

one can simply provide

my_prot//A/10-50/CA

Examples

zoom 142/             # zoom in on residue number 142

show spheres, 156/CA  # the alpha carbon of residue 156 is shown as a sphere

show cartoon, a//     # chain A is shown as a cartoon

color pink, pept//b   # chain B in object "pept" is colored pink

Macro Fields

In total, there are seven fields available for use in atom selection macros:

/entity/segment/chain/resName`resIdent/name`altLoc

  • entity = object-or-selection-name-pattern
  • segment = segment-identifier-pattern
  • chain = chain-identifier-pattern
  • resName = residue-name-pattern
  • resIdent = residue-identifier-pattern
  • name = atom-name-pattern
  • altLoc = alternate-location-pattern

Note that residue information is comprised of resName and resIdent, which are separated using a back-apostrophe (`), and the same is true of the atom information fields name and altLoc. All of the other fields are separated using a forward slash (/) with no spaces permitted. The purpose of this distinction is to allow you to provide either resName or resIdent as needs dictate, and to leave off the rarely used altLoc field.

Therefore, you can nomally think of selection macros as consisting of just five fields:

/entity/segment/chain/residue/atom

where residue and and atom fields accept flexible patterns. It is not necessary to specify all fields. You can simply pick and choose the ones you need.

With respect to the residue field, if you omit the back-apostrophe, then any character pattern containing a number (150A) will be interpreted as a residue identifier, resIdent, whereas any purely alphabetic (e.g. PHE) pattern will be interpreted as a residue name, resName. If you include a back-apostrophe, then any text in front of it will be considered a resName pattern, and any text after will be considered a resIdent pattern.

With respect to the atom field, if the back-apostrophe is omitted, then the text is always considered to be a name pattern. If the back-apostrophe is present, then the text in front of it is considered a name pattern, and the text after it is considered an altLoc pattern.

Macros come in two flavors: those that begin with a slash and those that don't. If the macro begins with a slash, PyMOL interprets each field from left to right:

/entity/segment/chain/residue/atom
/entity/segment/chain/residue
/entity/segment/chain
/entity/segment
/entity

Otherwise, PyMOL interprets the selection from right-to-left:

residue/atom
chain/residue/atom
segment/chain/residue/atom
entity/segment/chain/residue/atom
entity/segment/chain/residue/atom

Two of the most common forms are:

residue/

for matching residues (by name or by identifier):

phe/             # all phenylalanies
142-160/         # residues 142 through 160
arg+his+lys/     # positively charged residues

and

*/atom

for matching atom names:

*/CA              # all alpha carbons
*/C+N+CA+O        # all main chain atoms
*/N               # all backbone amide nitrogens
selection/macros.txt · Last modified: 2013/08/19 21:01 (external edit)