pyemma.coordinates.data.MDFeaturizer

class pyemma.coordinates.data.MDFeaturizer(topfile)

extracts features from MD trajectories.

Parameters:topfile (str) – a path to a topology file (pdb etc.)
__init__(topfile)

Methods

__init__(topfile)
add_all() Adds all atom coordinates to the feature list.
add_angles(indexes[, deg]) Adds the list of angles to the feature list
add_backbone_torsions([deg]) Adds all backbone phi/psi angles to the feature list.
add_contacts(atom_pairs[, threshold, periodic]) Adds the set of contacts to the feature list
add_custom_feature(feature) Adds a custom feature to the feature list.
add_custom_func(func, dim[, desc]) adds a user defined function to extract features
add_dihedrals(indexes[, deg]) Adds the list of dihedrals to the feature list
add_distances(atom_pairs[, periodic]) Adds the distances between the given pairs of atoms to the feature list.
add_distances_ca([periodic]) Adds the distances between all Ca’s (except for 1- and 2-neighbors) to the feature list.
add_inverse_distances(atom_pairs[, periodic]) Adds the inverse distances between the given pairs of atoms to the feature list.
add_selection(indexes) Adds the coordinates of the selected atom indexes to the feature list.
angles(func)
backbone_torsions(func)
contacts(func)
describe() Returns a list of strings, one for each feature selected, with human-readable descriptions of the features.
dimension() current dimension due to selected features
distances(func)
distancesCa(func)
inverse_distances(func)
map(traj) Maps an mdtraj Trajectory object to the selected output features
pairs(sel) Creates all pairs between indexes, except for 1 and 2-neighbors
select(selstring) Returns the indexes of atoms matching the given selection
select_Backbone() Returns the indexes of backbone C, CA and N atoms
select_Ca() Returns the indexes of all Ca-atoms
select_Heavy() Returns the indexes of all heavy atoms (Mass >= 2)
add_all()

Adds all atom coordinates to the feature list. The coordinates are flattened as follows: [x1, y1, z1, x2, y2, z2, ...]

add_angles(indexes, deg=False)

Adds the list of angles to the feature list

Parameters:
  • indexes (np.ndarray, shape=(num_pairs, 3), dtype=int) – an array with triplets of atom indices
  • deg (bool, optional, default = False) – If False (default), angles will be computed in radians. If True, angles will be computed in degrees.
add_backbone_torsions(deg=False)

Adds all backbone phi/psi angles to the feature list.

Parameters:deg (bool, optional, default = False) – If False (default), angles will be computed in radians. If True, angles will be computed in degrees.
add_contacts(atom_pairs, threshold=5.0, periodic=True)

Adds the set of contacts to the feature list

Parameters:
  • atom_pairs (ndarray((n, 2), dtype=int)) – n x 2 array of pairs of atoms to compute contacts between
  • threshold (float, optional, default = 5.0) – distances below this threshold will result in a feature 1.0, distances above will result in 0.0. The default is set with Angstrom distances in mind. Make sure that you know whether your coordinates are in Angstroms or nanometers when setting this threshold.
add_custom_feature(feature)

Adds a custom feature to the feature list.

Parameters:feature (object) – an object with interface like CustomFeature (map, describe methods)
add_custom_func(func, dim, desc='', *args, **kwargs)

adds a user defined function to extract features

Parameters:
  • func (function) – a user-defined function, which accepts mdtraj.Trajectory object as first parameter and as many optional and named arguments as desired. Has to return a numpy.ndarray
  • dim (int) – output dimension of function
  • desc (str) – description of your feature function
  • args (list) – positional arguments passed to func
  • kwargs (dictionary) – named arguments passed to func
add_dihedrals(indexes, deg=False)

Adds the list of dihedrals to the feature list

Parameters:
  • indexes (np.ndarray, shape=(num_pairs, 4), dtype=int) – an array with quadruplets of atom indices
  • deg (bool, optional, default = False) – If False (default), angles will be computed in radians. If True, angles will be computed in degrees.
add_distances(atom_pairs, periodic=True)

Adds the distances between the given pairs of atoms to the feature list.

Parameters:atom_pairs (ndarray((n, 2), dtype=int)) – n x 2 array with pairs of atoms between which the distances shall be computed
add_distances_ca(periodic=True)

Adds the distances between all Ca’s (except for 1- and 2-neighbors) to the feature list.

add_inverse_distances(atom_pairs, periodic=True)

Adds the inverse distances between the given pairs of atoms to the feature list.

Parameters:atom_pairs (ndarray((n,2), dtype=int)) – n x 2 array with pairs of atoms between which the inverse distances shall be computed
add_selection(indexes)

Adds the coordinates of the selected atom indexes to the feature list. The coordinates of the selection [1, 2, ...] are flattened as follows: [x1, y1, z1, x2, y2, z2, ...]

Parameters:indexes (ndarray((n), dtype=int)) – array with selected atom indexes
describe()

Returns a list of strings, one for each feature selected, with human-readable descriptions of the features.

Returns:labels – An ordered list of strings, one for each feature selected, with human-readable descriptions of the features.
Return type:list of str
dimension()

current dimension due to selected features

Returns:dim – total dimension due to all selection features
Return type:int
map(traj)

Maps an mdtraj Trajectory object to the selected output features

Parameters:traj (mdtraj Trajectory) – Trajectory object used as an input
Returns:out – Output features: For each of T time steps in the given trajectory, a vector with all n output features selected.
Return type:ndarray((T, n), dtype=float32)
static pairs(sel)

Creates all pairs between indexes, except for 1 and 2-neighbors

Parameters:
  • sel (ndarray((m,2), dtype=int)) – array with selected atom indexes
  • Return
  • -------
  • sel – m x 2 array with all pair indexes between different atoms that are at least 3 indexes apart, i.e. if i is the index of an atom, the pairs [i,i-2], [i,i-1], [i,i], [i,i+1], [i,i+2], will not be in sel. Moreover, the list is non-redundant, i.e. if [i,j] is in sel, then [j,i] is not.
select(selstring)

Returns the indexes of atoms matching the given selection

Parameters:selstring (str) – Selection string. See mdtraj documentation for details: http://mdtraj.org/latest/atom_selection.html
Returns:indexes – array with selected atom indexes
Return type:ndarray((n), dtype=int)
select_Backbone()

Returns the indexes of backbone C, CA and N atoms

Returns:indexes – array with selected atom indexes
Return type:ndarray((n), dtype=int)
select_Ca()

Returns the indexes of all Ca-atoms

Returns:indexes – array with selected atom indexes
Return type:ndarray((n), dtype=int)
select_Heavy()

Returns the indexes of all heavy atoms (Mass >= 2)

Returns:indexes – array with selected atom indexes
Return type:ndarray((n), dtype=int)