Property Selectors: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(merge noted)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div style="background-color: #9f9; padding: 10px; margin-bottom: 20px; text-align: center">
Most of this page has been merged into [[Selection Algebra]]
</div>
==Property Selectors==
==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.
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.
Line 11: Line 15:
PyMOL> select nterm, resi 1-3
PyMOL> select nterm, resi 1-3
</source>
</source>
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
The identifier for a blank field in an input file is an empty pair of quotes
<source lang="python">
PyMOL> select mistake, resi 1-3+6      <--This is WRONG
</source>
The identifier for a blank field in an input file is and empty pair of quotes
<source lang="python">
<source lang="python">
PyMOL> select unstruct, ss ""  # A named selection is created
PyMOL> select unstruct, ss ""  # A named selection is created
Line 34: Line 34:
<BR> list of 1- or 2-letter chemical symbols from the periodic table
<BR> list of 1- or 2-letter chemical symbols from the periodic table
<BR>
<BR>
<pre>PyMOL> select polar, symbol o+n</pre>
<pre>PyMOL> select polar, symbol O+N</pre>
</TD></TR>
</TD></TR>
<TR><TD ALIGN="CENTER">name</TD><TD ALIGN="CENTER"> n.</TD><TD><I>
<TR><TD ALIGN="CENTER">name</TD><TD ALIGN="CENTER"> n.</TD><TD><I>
atom-name-list</I>
atom-name-list</I>
<BR> list of up to 4-letter codes for atoms in proteins or nucleic acids
<BR> list of up to 4-letter codes for atoms in proteins or nucleic acids
<BR>
<BR>
<pre>PyMOL> select carbons, name ca+cb+cg+cd</pre>
<pre>PyMOL> select carbons, name CA+CB+CG+CD</pre>
</TD></TR>
</TD></TR>
<TR><TD ALIGN="CENTER">resn</TD><TD ALIGN="CENTER"> r.</TD><TD><I>
<TR><TD ALIGN="CENTER">resn</TD><TD ALIGN="CENTER"> r.</TD><TD><I>
residue-name-list</I>
residue-name-list</I>
<BR> list of 3-letter codes for amino acids
<BR> list of 3-letter codes for amino acids
<BR>
<BR>
<pre>PyMOL> select aas, resn asp+glu+asn+gln </pre>
<pre>PyMOL> select aas, resn ASP+GLU+ASN+GLN</pre>
or list of up to 2-letter codes for nucleic acids
or list of up to 2-letter codes for nucleic acids
<BR>
<BR>
<pre>PyMOL&gt; select bases, resn a+g</pre>
<pre>PyMOL&gt; select bases, resn A+G</pre>
</TD></TR>
</TD></TR>
<TR><TD ALIGN="CENTER">resi</TD><TD ALIGN="CENTER"> i.</TD><TD><I>
<TR><TD ALIGN="CENTER">resi</TD><TD ALIGN="CENTER"> i.</TD><TD><I>
Line 67: Line 65:
alternate-conformation-identifier-list</I>
alternate-conformation-identifier-list</I>
<BR> list of single letters
<BR> list of single letters
<pre>PyMOL> select altconf, alt a+&quot;&quot;</pre>
<pre>PyMOL> select altconf, alt A+&quot;&quot;</pre>
</TD></TR>
</TD></TR>
<TR><TD ALIGN="CENTER">chain</TD><TD ALIGN="CENTER"> c.</TD><TD><I>
<TR><TD ALIGN="CENTER">chain</TD><TD ALIGN="CENTER"> c.</TD><TD><I>
Line 74: Line 72:
<BR> list of single letters or sometimes numbers
<BR> list of single letters or sometimes numbers
<BR>
<BR>
<pre>PyMOL> select firstch, chain a</pre>
<pre>PyMOL> select firstch, chain A</pre>
</TD></TR>
</TD></TR>
<TR><TD ALIGN="CENTER"> segi</TD><TD ALIGN="CENTER"> s.</TD><TD><I>
<TR><TD ALIGN="CENTER"> segi</TD><TD ALIGN="CENTER"> s.</TD><TD><I>
segment-identifier-list</I>
segment-identifier-list</I>
<BR> list of up to 4 letter identifiers
<BR> list of up to 4 letter identifiers
<pre>PyMOL> select ligand, segi lig </pre>
<pre>PyMOL> select ligand, segi lig </pre>
Line 110: Line 107:
<TR><TD ALIGN="CENTER">index</TD><TD ALIGN="CENTER"> idx.</TD><TD><I>
<TR><TD ALIGN="CENTER">index</TD><TD ALIGN="CENTER"> idx.</TD><TD><I>
internal-index-number</I>
internal-index-number</I>
<BR> a single integer
<BR> a single integer
<BR>
<BR>
Line 118: Line 114:
secondary-structure-type</I>
secondary-structure-type</I>
<BR> list of single letters
<BR> list of single letters
<BR>
<BR>
<pre>PyMOL> select allstrs, ss h+s+l+&quot;&quot;</pre>
<pre>PyMOL> select allstrs, ss H+S+L+&quot;&quot;</pre>
</TD></TR>
</TD></TR>
</TABLE>
</TABLE>
Line 152: Line 147:
<TR><TD ALIGN="CENTER">&nbsp; partial_charge &nbsp;</TD><TD ALIGN="CENTER"> pc.</TD><TD>
<TR><TD ALIGN="CENTER">&nbsp; partial_charge &nbsp;</TD><TD ALIGN="CENTER"> pc.</TD><TD>
<I> comparison-operator partial charge-value</I>
<I> comparison-operator partial charge-value</I>
<BR> a real number
<BR> a real number
<pre>PyMOL> select hicharges, pc. &gt; 1</pre>
<pre>PyMOL> select hicharges, pc. &gt; 1</pre>
Line 216: Line 210:
== See Also ==
== See Also ==


* [[Single-word Selectors]]
[[Single-word Selectors]] [[Selection Macros]] [[Selection_Algebra]] [[Identify]]
* [[Selection Macros]]
* [[Selection_Algebra]]




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

Latest revision as of 05:35, 29 November 2017

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,
ATOM    949  N   ARG A 124       6.039   8.484   9.313  1.00  9.82           N
ATOM    950  CA  ARG A 124       5.839   7.071   8.980  1.00 10.05           C
ATOM    951  C   ARG A 124       6.009   6.809   7.493  1.00  9.18           C
ATOM    952  O   ARG A 124       5.803   7.715   6.648  1.00  9.06           O
ATOM    953  CB  ARG A 124       4.437   6.660   9.425  1.00 10.61           C
ATOM    954  CG AARG A 124       4.381   6.539  10.955  0.50 12.54           C
ATOM    955  CG BARG A 124       4.170   6.743  10.930  0.50 14.58           C
ATOM    956  CD AARG A 124       2.996   6.418  11.561  0.50 11.86           C
ATOM    957  CD BARG A 124       2.700   7.091  11.242  0.50 17.41           C
ATOM    958  NE AARG A 124       2.110   7.506  11.144  0.50 13.01           N
ATOM    959  NE BARG A 124       2.229   6.746  12.588  0.50 19.94           N
ATOM    960  CZ AARG A 124       0.912   7.729  11.654  0.50 12.21           C
ATOM    961  CZ BARG A 124       2.123   5.510  13.067  0.50 21.42           C
ATOM    962  NH1AARG A 124       0.433   6.958  12.627  0.50 12.93           N
ATOM    963  NH1BARG A 124       2.470   4.470  12.319  0.50 24.35           N
ATOM    964  NH2AARG A 124       0.185   8.735  11.188  0.50 11.89           N
ATOM    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