Property Selectors: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
Line 173: Line 173:
Try it on 1CBN.
Try it on 1CBN.


* To select and remove all atoms with alternate locations (alt loc, ALT) try:
<source lang="python">
remove not (alt ''+A)
alter all, alt=''
</source>




[[Category:Selector Quick Reference]]
[[Category:Selector Quick Reference]]
[[Category:Selecting|Selector Quick Reference]]
[[Category:Selecting|Selector Quick Reference]]

Revision as of 08:53, 9 September 2008

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

However, you will get an error message if you try to combine a list and a range in an identifier to a resi as in

PyMOL> select mistake, resi 1-3+6      <--This is WRONG

The identifier for a blank field in an input file is and 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

<B>PyMOL></B> 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

<B>PyMOL></B> 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

  • 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).


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

Try it on 1CBN.

  • To select and remove all atoms with alternate locations (alt loc, ALT) try:
remove not (alt ''+A)
alter all, alt=''