Property Selectors

From PyMOLWiki
Revision as of 05:35, 29 November 2017 by Speleo3 (talk | contribs) (merge noted)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Most of this page has been merged into Selection Algebra

Property Selectors

PyMOL reads data files written in PDB, MOL/SDF, Macromodel, ChemPy Model, and Tinker XYZ formats. Some of the data fields in these formats allow PyMOL to assign properties to atoms. You can group and select atoms according to these properties using property selectors and identifiers: the selectors correspond to the fields in the data files, and the identifiers correspond to the target words to match, or the target numbers to compare.

General

The items in a list of identifiers are separated by plus signs (+) only. Do not add spaces within a list of identifiers. The selector resi takes (+)-separated lists of identifiers, as in

PyMOL> select nterm, resi 1+2+3

or, alternatively, it may take a range given with a dash

PyMOL> select nterm, resi 1-3

The identifier for a blank field in an input file is an empty pair of quotes

PyMOL> select unstruct, ss ""   # A named selection is created
                                # to contain all atoms that are not assigned 
                                # a secondary structure.

Property Selector Table

Most property selectors select matches to their identifiers

Matching Property Selector Short Form Selector Identifier and Example
symbol e.

chemical-symbol-list
list of 1- or 2-letter chemical symbols from the periodic table

PyMOL> select polar, symbol O+N
name n.

atom-name-list
list of up to 4-letter codes for atoms in proteins or nucleic acids

PyMOL> select carbons, name CA+CB+CG+CD
resn r.

residue-name-list
list of 3-letter codes for amino acids

PyMOL> select aas, resn ASP+GLU+ASN+GLN

or list of up to 2-letter codes for nucleic acids

PyMOL> select bases, resn A+G
resi i.

residue-identifier-list
list of up to 4-digit residue numbers

PyMOL> select mults10, resi 1+10+100+1000

residue-identifier-range

PyMOL> select nterm, resi 1-10
alt alt

alternate-conformation-identifier-list
list of single letters

PyMOL> select altconf, alt A+""
chain c.

chain-identifier-list
list of single letters or sometimes numbers

PyMOL> select firstch, chain A
segi s.

segment-identifier-list
list of up to 4 letter identifiers

PyMOL> select ligand, segi lig 
flag f.

flag-number
a single integer from 0 to 31

PyMOL> select f1, flag 0
  numeric_type   nt.

type-number
a single integer

PyMOL> select type1, nt. 5
text_type tt.

type-string
a list of up to 4 letter codes

PyMOL> select subset, text_type HA+HC
id id

external-index-number
a single integer

PyMOL> select idno, id 23
index idx.

internal-index-number
a single integer

PyMOL> select intid, index 11
ss ss

secondary-structure-type
list of single letters

PyMOL> select allstrs, ss H+S+L+""


Numeric Selector Table

Other property selectors select by comparison to numeric identifiers

Numeric Selector Short Form Argument and Example
b b

comparison-operator b-factor-value
a real number

PyMOL> select fuzzy, b > 10
q q

comparison-operator occupancy-value
a real number

PyMOL> select lowcharges, q <0.50
  formal_charge   fc.

comparison-operator formal charge-value
an integer

PyMOL> select doubles, fc. = -1
  partial_charge   pc.

comparison-operator partial charge-value
a real number

PyMOL> select hicharges, pc. > 1


User Notes

Select by PDB Assigned Atom Number

To select atoms by their PDB ATOM number, use the id selector:

 select Nt, id 1-30

makes a new selection called Nt and puts in it the first 30 atoms (assuming your PDB starts numbering at 1).

Selecting via a Negative Identifier

If you have a residue id < 0, eg. resi -55, then you have to escape the minus sign or renumber the atoms:

select i. \-55

Alternate Locations

Select All Alternate Locations

  • To select all residues with alternate locations (alt, alt loc), simply do:
select aa, not alt ""

Try it on 1CBN.

Select All Alternate Locations Except the A-Locations

  • To select and remove all atoms with alternate locations (ALT, alt loc) that aren't the A record try the following. This removes all alt locations that are not the original A location. For example given the following pdb record,
 1ATOM    949  N   ARG A 124       6.039   8.484   9.313  1.00  9.82           N
 2ATOM    950  CA  ARG A 124       5.839   7.071   8.980  1.00 10.05           C
 3ATOM    951  C   ARG A 124       6.009   6.809   7.493  1.00  9.18           C
 4ATOM    952  O   ARG A 124       5.803   7.715   6.648  1.00  9.06           O
 5ATOM    953  CB  ARG A 124       4.437   6.660   9.425  1.00 10.61           C
 6ATOM    954  CG AARG A 124       4.381   6.539  10.955  0.50 12.54           C
 7ATOM    955  CG BARG A 124       4.170   6.743  10.930  0.50 14.58           C
 8ATOM    956  CD AARG A 124       2.996   6.418  11.561  0.50 11.86           C
 9ATOM    957  CD BARG A 124       2.700   7.091  11.242  0.50 17.41           C
10ATOM    958  NE AARG A 124       2.110   7.506  11.144  0.50 13.01           N
11ATOM    959  NE BARG A 124       2.229   6.746  12.588  0.50 19.94           N
12ATOM    960  CZ AARG A 124       0.912   7.729  11.654  0.50 12.21           C
13ATOM    961  CZ BARG A 124       2.123   5.510  13.067  0.50 21.42           C
14ATOM    962  NH1AARG A 124       0.433   6.958  12.627  0.50 12.93           N
15ATOM    963  NH1BARG A 124       2.470   4.470  12.319  0.50 24.35           N
16ATOM    964  NH2AARG A 124       0.185   8.735  11.188  0.50 11.89           N
17ATOM    965  NH2BARG A 124       1.658   5.310  14.313  0.50 18.28           N

the command below will remove the (not A so) B-locations (lines 7, 9, 11, 13, 15, 17).

# select & remove all non A altlocs
remove not (alt ''+A)
# reset the PDB information
alter all, alt=''

See also, removeAlt for a script to do this for you.

See Also

Single-word Selectors Selection Macros Selection_Algebra Identify