Atomic Data¶
This module defines classes for handling atomic data. Read this page using
help(atomic)
.
Atomic classes¶
ProDy stores atomic data in instances of AtomGroup
class, which
supports multiple coordinate sets, e.g. models from an NMR structure or
snapshots from a molecular dynamics trajectory.
Instances of the class can be obtained by parsing a PDB file as follows:
In [1]: from prody import *
In [2]: ag = parsePDB('1aar')
In [3]: ag
Out[3]: <AtomGroup: 1aar (1218 atoms)>
In addition to AtomGroup
class, following classes that act as
pointers provide convenient access subset of data:
Selection
- Points to an arbitrary subset of atoms. See Atom Selections and Operations on Selections for usage examples.Segment
- Points to atoms that have the same segment name.Chain
- Points to atoms in a segment that have the same chain identifier.Residue
- Points to atoms in a chain that have the same residue number and insertion code.AtomMap
- Points to arbitrary subsets of atoms while allowing for duplicates and missing atoms. Indices of atoms are stored in the order provided by the user.Atom
- Points to a single atomBond
- Points to two connected atoms
Atom data fields¶
Atom Data Fields defines an interface for handling data parsed from molecular
data files, in particular PDB files. Aforementioned classes offer get
and set
functions for manipulating this data. For example, the following
prints residue names:
In [4]: ag.getResnames()
Out[4]: array(['MET', 'MET', 'MET', ..., 'HOH', 'HOH', 'HOH'], dtype='|S6')
Atom flags¶
Atom Flags module defines a way to mark atoms with certain properties, such as atoms that are part of a protein. Following example checks whether all atoms of ag are protein atoms:
In [5]: ag.isprotein
Out[5]: False
This indicates that there are some non-protein atoms, probably water atoms. We can easily make a count as follows:
In [6]: ag.numAtoms('protein')
Out[6]: 1203
In [7]: ag.numAtoms('hetero')
Out[7]: 15
In [8]: ag.numAtoms('water')
Out[8]: 15
Atom selections¶
Atom Selections offer a flexible and powerful way to access subsets of
selections and is one of the most important features of ProDy. The details
of the selection grammar is described in Atom Selections. Following examples
show how to make quick selections using the overloaded .
operator:
In [9]: ag.chain_A # selects chain A
Out[9]: <Selection: 'chain A' from 1aar (608 atoms)>
In [10]: ag.calpha # selects alpha carbons
Out[10]: <Selection: 'calpha' from 1aar (152 atoms)>
In [11]: ag.resname_ALA # selects alanine residues
Out[11]: <Selection: 'resname ALA' from 1aar (20 atoms)>
It is also possible to combine selections with and
and or
operators:
In [12]: ag.chain_A_and_backbone
Out[12]: <Selection: 'chain A and backbone' from 1aar (304 atoms)>
In [13]: ag.acidic_or_basic
Out[13]: <Selection: 'acidic or basic' from 1aar (422 atoms)>
Using dot operator will behave like the logical and
operator:
In [14]: ag.chain_A.backbone
Out[14]: <Selection: '(backbone) and (chain A)' from 1aar (304 atoms)>
For this to work, the first word following the dot operator must be a flag
label or a field name, e.g. resname
, name
, apolar
, protein
,
etc. Underscores will be interpreted as white space, as obvious from the
previous examples. The limitation of this is that parentheses, special
characters cannot be used.
Functions¶
The following functions can be used for permanent data storage:
The following functions can be used to identify fragments in a group
(AtomGroup
) or subset (Selection
) of atoms:
The following function can be used to get an AtomMap
that sorts atoms
based on a given property:
The following function can be used check whether a word is reserved because
it is used internally by prody.atomic
classes: