Previous topic

7.2. Fundamental building blocks — MDAnalysis.core.AtomGroup

Next topic

7.4. Compute observable timeseries from trajectories — MDAnalysis.core.Timeseries

This Page

7.3. Atom selection Hierarchy — MDAnalysis.core.Selection

These objects are constructed and applied to the group

Currently all atom arrays are handled internally as sets, but returned as AtomGroups

class MDAnalysis.core.Selection.BackboneSelection[source]

A BackboneSelection contains all atoms with name ‘N’, ‘CA’, ‘C’, ‘O’.

This excludes OT* on C-termini (which are included by, eg VMD’s backbone selection).

class MDAnalysis.core.Selection.BaseSelection[source]

Selection of atoms in nucleobases.

Recognized atom names (from CHARMM):

‘N9’, ‘N7’, ‘C8’, ‘C5’, ‘C4’, ‘N3’, ‘C2’, ‘N1’, ‘C6’, ‘O6’,’N2’,’N6’, ‘O2’,’N4’,’O4’,’C5M’
class MDAnalysis.core.Selection.CASelection[source]

Select atoms named CA in protein residues (supposed to be the C-alphas)

class MDAnalysis.core.Selection.NucleicBackboneSelection[source]

A NucleicBackboneSelection contains all atoms with name “P”, “C5’”, C3’”, “O3’”, “O5’”.

These atoms are only recognized if they are in a residue matched by the NucleicSelection.

class MDAnalysis.core.Selection.NucleicSelection[source]

A nucleic selection consists of all atoms in nucleic acid residues with recognized residue names.

Recognized residue names:

  • from the CHARMM force field ::

    awk ‘/RESI/ {printf “’”’”%s”’”’,”,$2 }’ top_all27_prot_na.rtf

    • recognized: ‘ADE’, ‘URA’, ‘CYT’, ‘GUA’, ‘THY’
  • recognized (CHARMM in Gromacs): ‘DA’, ‘DU’, ‘DC’, ‘DG’, ‘DT’

Changed in version 0.8: additional Gromacs selections (see also NucleicXstalSelection)

class MDAnalysis.core.Selection.NucleicSugarSelection[source]

A NucleicSugarSelection contains all atoms with name C1’, C2’, C3’, C4’, O2’, O4’, O3’.

class MDAnalysis.core.Selection.PropertySelection(prop, operator, value, abs=False)[source]

Some of the possible properties: x, y, z, radius, mass,

class MDAnalysis.core.Selection.ProteinSelection[source]

A protein selection consists of all residues with recognized residue names.

Recognized residue names in ProteinSelection.prot_res.

  • from the CHARMM force field::

    awk ‘/RESI/ {printf “’”’”%s”’”’,”,$2 }’ top_all27_prot_lipid.rtf

  • manually added special CHARMM, OPLS/AA and Amber residue names.

  • still missing: Amber N- and C-terminal residue names

prot_res = {'GLH': None, 'ILE': None, 'ALAD': None, 'GLUH': None, 'GLN': None, 'HISH': None, 'ASN1': None, 'HYP': None, 'GLY': None, 'HIP': None, 'ARGN': None, 'MSE': None, 'CYS1': None, 'GLU': None, 'CYS2': None, 'CYS': None, 'HISE': None, 'ASP': None, 'SER': None, 'HSD': None, 'HSE': None, 'PRO': None, 'CYX': None, 'ASPH': None, 'ORN': None, 'HSP': None, 'HID': None, 'HIE': None, 'LYN': None, 'DAB': None, 'ASN': None, 'CYM': None, 'HISD': None, 'VAL': None, 'THR': None, 'HISB': None, 'HIS': None, 'HIS1': None, 'HIS2': None, 'TRP': None, 'HISA': None, 'ACE': None, 'ASH': None, 'CYSH': None, 'PGLU': None, 'LYS': None, 'PHE': None, 'ALA': None, 'QLN': None, 'MET': None, 'LYSH': None, 'NME': None, 'LEU': None, 'ARG': None, 'TYR': None}

Dictionary of recognized residue names (3- or 4-letter).

class MDAnalysis.core.Selection.SelectionParser[source]

A small parser for selection expressions. Demonstration of recursive descent parsing using Precedence climbing (see http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm). Transforms expressions into nested Selection tree.

For reference, the grammar that we parse is

E(xpression)--> Exp(0)
Exp(p) -->      P {B Exp(q)}
P -->           U Exp(q) | "(" E ")" | v
B(inary) -->    "and" | "or"
U(nary) -->     "not"
T(erms) -->     segid [value]
                | resname [value]
                | resid [value]
                | name [value]
                | type [value]