This module defines AtomMap class that allows for pointing atoms in arbitrary order.
AtomMap class adds great flexibility to manipulating atomic data.
First let’s see how an instance of Selection (Chain, or Residue) works. Below table shows indices for a selection of atoms in an AtomGroup and values returned when getNames(), getResnames() and getResnums() methods are called.
Indices | Names | Resnames | Resnums |
---|---|---|---|
0 | N | PHE | 1 |
1 | CA | PHE | 1 |
2 | C | PHE | 1 |
3 | O | PHE | 1 |
4 | CB | PHE | 1 |
5 | CG | PHE | 1 |
6 | CD1 | PHE | 1 |
7 | CD2 | PHE | 1 |
8 | CE1 | PHE | 1 |
9 | CE2 | PHE | 1 |
10 | CZ | PHE | 1 |
Selection instances keep indices ordered and do not allow duplicate values, hence their use is limited. In an AtomMap, indices do not need to be sorted, duplicate indices may exist, even “DUMMY” atoms are allowed.
Let’s say we instantiate the following AtomMap:
amap = AtomMap(atomgroup, indices=[0, 1, 3, 8, 8, 9, 10],
mapping=[5, 6, 7, 0, 1, 2, 3])
The size of the AtomMap based on this mapping is 8, since the larger mapping is 7.
Calling the same functions for this AtomMap instance would result in the following:
Mapping | Indices | Names | Resnames | Resnums | MappedFlags | DummyFlags |
---|---|---|---|---|---|---|
0 | 8 | CE1 | PHE | 1 | 1 | 0 |
1 | 8 | CE1 | PHE | 1 | 1 | 0 |
2 | 9 | CE2 | PHE | 1 | 1 | 0 |
3 | 10 | CZ | PHE | 1 | 1 | 0 |
4 | 0 | 0 | 1 | |||
5 | 0 | N | PHE | 1 | 1 | 0 |
6 | 1 | CA | PHE | 1 | 1 | 0 |
7 | 3 | O | PHE | 1 | 1 | 0 |
For unmapped atoms, numeric attributes are set to 0, others to empty string, i.e. "".
See also
AtomMap are used by proteins module functions that match or map protein chains. Heterogeneous X-ray Structures and Multimeric Structures examples that make use of these functions and AtomMap class.
A class for mapping atomic data.
Instantiate an atom map.
Parameters: |
|
---|
mapping and dummies arrays must be provided together. Length of mapping must be equal to length of indices. Elements of mapping must be an ordered in ascending order. When dummy atoms are present, number of atoms is the sum of lengths of mapping and dummies.
Following built-in functions are customized for this class:
Return index of the coordinate set.
Return active coordinate set label.
Return a copy of alternate location indicators. Entries for dummy atoms will be ''.
Return a copy of anisotropic temperature factors. Entries for dummy atoms will be 0.0.
Return a copy of standard deviations for anisotropic temperature factors. Entries for dummy atoms will be 0.0.
Return associated atom group.
Return a copy of β-values (or temperature factors). Entries for dummy atoms will be 0.0.
Return coordinate set labels.
Return a copy of partial charges. Entries for dummy atoms will be 0.0.
Return a copy of chain identifiers. Entries for dummy atoms will be ''.
Return a copy of chain indices. Chain indices are assigned to subsets of atoms with distinct pairs of chain identifier and segment name. Chain indices start from zero, are incremented by one, and are assigned in the order of appearance in AtomGroup instance. Entries for dummy atoms will be 0.
Return coordinate set(s) at given indices, which may be an integer or a list/array of integers.
Return data labels. For which='user', return only labels of user provided data.
Return type of the data (i.e. data.dtype) associated with label, or None label is not used.
Return a copy of element symbols. Entries for dummy atoms will be ''.
Return flag labels. For which='user', return labels of user or parser (e.g. hetatm) provided flags, for which='all' return all possible Atom Flags labels in addition to those present in the instance.
Return a copy of atom flags for given label, or None when flags for label is not set.
Return a copy of fragment indices. Fragment indices are assigned to connected subsets of atoms. Bonds needs to be set using AtomGroup.setBonds() method. Fragment indices start from zero, are incremented by one, and are assigned in the order of appearance in AtomGroup instance. Entries for dummy atoms will be 0.
Return a copy of insertion codes. Entries for dummy atoms will be ''.
Return a copy of masses. Entries for dummy atoms will be 0.0.
Return a copy of names. Entries for dummy atoms will be ''.
Return a copy of occupancy values. Entries for dummy atoms will be 0.0.
Return a copy of radii. Entries for dummy atoms will be 0.0.
Return a copy of residue indices. Residue indices are assigned to subsets of atoms with distinct sequences of residue number, insertion code, chain identifier, and segment name. Residue indices start from zero, are incremented by one, and are assigned in the order of appearance in AtomGroup instance. Entries for dummy atoms will be 0.
Return a copy of residue names. Entries for dummy atoms will be ''.
Return a copy of residue numbers. Entries for dummy atoms will be 0.
Return a copy of secondary structure assignments. Entries for dummy atoms will be ''.
Return a copy of segment indices. Segment indices are assigned to subsets of atoms with distinct segment names. Segment indices start from zero, are incremented by one, and are assigned in the order of appearance in AtomGroup instance. Entries for dummy atoms will be 0.
Return a copy of segment names. Entries for dummy atoms will be ''.
Return a copy of serial numbers (from file). Entries for dummy atoms will be 0.
Return a copy of types. Entries for dummy atoms will be ''.
Return True if data associated with label is present.
Return True if flags associated with label are present.
Return number of coordinate sets.
Return atoms matching selstr criteria. See select module documentation for details and usage examples.
Set coordinates at index active.