nrgten.metrics

nrgten.metrics.get_transit_probs(enm_a, enm_b, gamma=1, alignment=None)

Computes the transition ‘probabilities’ of reaching state B from state A and vice versa.

Parameters:
  • enm_a (ENM) – The ENM object representing state A.

  • enm_b (ENM) – The ENM object representing state B.

  • gamma (float, optional) – The Boltzmann scaling factor.

  • alignment (list, optional) – list of 2 lists of matching indices. Example: The alignment of sequences enm_a: -XYY-Z and enm_b: ZXYYXZ would give alignment=[[0,1,2,3],[1,2,3,5]]

Returns:

tuple containing:

p_a(float): the probability of reaching state A from state B

p_b(float): the probability of reaching state B from state A

Return type:

tuple

nrgten.metrics.fit(reference, target, alignment=None, filter=None)

Fits the target to the reference.

Only the masses that have centers in the filter set are kept (all are kept if filter is None). An alignment can also be applied to select corresponding masses. It is applied after filtering.

Note

Only the conformational change vector is returned, and the target ENM object is left untouched. This vector does not include the 6 trivial 3-D degrees of freedom (rotational and translational).

Warning

The target object is manipulated during this operation. Could lead to nasty effects if used naively during parallel computing.

Parameters:
  • reference (ENM) – The reference ENM object to which the target will be fitted.

  • target (ENM) – The target ENM object which will be fitted to the reference.

  • alignment (list, optional) – list of 2 lists of matching indices. Example: The alignment of sequences enm_a: -XYY-Z and enm_b: ZXYYXZ would give alignment=[[0,1,2,3],[1,2,3,5]]

  • filter (set, optional) – set containing the names (str) of the center atoms for the masses to keep.

Returns:

a vector representing the conformational change from reference to target

Return type:

np.ndarray

nrgten.metrics.get_amplitudes_for_fit(reference, target, n_modes, alignment=None, filter=None)

This gives the amplitudes to apply to each eigenvector of the target to get as close as possible to the target.

Parameters:
  • reference (ENM) – The reference ENM object to which the target will be fitted.

  • target (ENM) – The target ENM object which will be fitted to the reference.

  • n_modes (int) – The number of normal modes for which coefficients will be returned.

  • alignment (list, optional) – list of 2 lists of matching indices. Example: The alignment of sequences enm_a: -XYY-Z and enm_b: ZXYYXZ would give alignment=[[0,1,2,3],[1,2,3,5]]

  • filter (set, optional) – set containing the names (str) of the center atoms for the masses to keep.

Returns:

a vector of amplitudes of length n_modes

Return type:

np.ndarray

nrgten.metrics.cumulative_overlap(reference, target, n_modes, alignment=None, filter=None)

Cumulative overlap, as defined in Zimmerman and Jernigan 2014, Eq. 4.

This computes the cumulative overlap between the n_modes first normal modes of the reference and the conformational change going from reference to target. See Eq. 4 from doi.org/10.1261/rna.041269.113

Parameters:
  • reference (ENM) – The reference ENM object to which the target will be fitted.

  • target (ENM) – The target ENM object which will be fitted to the reference.

  • n_modes (int) – The number of normal modes for which the cumulative overlap will be returned.

  • alignment (list, optional) – list of 2 lists of matching indices. Example: The alignment of sequences enm_a: -XYY-Z and enm_b: ZXYYXZ would give alignment=[[0,1,2,3],[1,2,3,5]]

  • filter (set, optional) – set containing the names (str) of the center atoms for the masses to keep.

Returns:

the cumulative overlap, using the n_modes first normal modes

Return type:

float

nrgten.metrics.get_overlaps(reference, target, n_modes, alignment=None, filter=None)

Computes the overlaps between the n_modes from target and the conformational change.

The conformational change is the vector of displacement going from reference to target, without translational/rotational degrees of freedom.

Parameters:
  • reference (ENM) – The reference ENM object to which the target will be fitted.

  • target (ENM) – The target ENM object which will be fitted to the reference.

  • n_modes (int) – The number of normal modes for which the overlaps will be returned.

  • alignment (list, optional) – list of 2 lists of matching indices. Example: The alignment of sequences enm_a: -XYY-Z and enm_b: ZXYYXZ would give alignment=[[0,1,2,3],[1,2,3,5]]

  • filter (set, optional) – set containing the names (str) of the center atoms for the masses to keep.

Returns:

The list of overlaps, of length n_modes.

Return type:

list

nrgten.metrics.pca_ensemble(enm, macromols_list=None, variance_to_explain=0.99, filter=None)

Principal component analysis on an ensemble of structures.

Parameters:
  • enm (ENM) – An ENM object from which the starting structure will be taken. If the macromols_list optional argument is None, this object must also contain at least one other state of the macromolecule (the PDB file must be in NMR format with MODEL and ENDMDL records).

  • macromols_list (list, optional) – A list of Macromol objects which will be used to compute the PCs.

  • variance_to_explain (float, optional) – The target proportion of variance explained by the PCs.

  • filter (set, optional) – set containing the names (str) of the center atoms for the masses to keep.

Warning

The structures other than the starting structures are restored to their initial states at the end but are temporarily disturbed during the computation. This could lead to nasty effects if parallel computing is attempted without care.

Returns:

tuple containing:

proportion_variance(numpy.ndarray): the proportion of variance explained by each PC

components(numpy.ndarray): the PCs in matrix notation, 1 PC per row

Return type:

tuple

nrgten.metrics.rmsip(ref_vectors, vectors_list)

Root mean square inner product, as defined in Leo-Macias et al. 2005.

Link to the paper: doi.org/10.1529/biophysj.104.052449

Parameters:
  • ref_vectors (np.ndarray) – the reference vectors (PCs), in matrix form with one vector per row.

  • vectors_list (np.ndarray) – the vectors to test (eigenvectors describing normal modes) in matrix form with one vector per row.

Returns:

The root mean square inner product (RMSIP).

Return type:

float