trajectory_analysis
– DRMSD, Pairwise Distances and More¶
This Module requires numpy
This module contains functions to analyze trajectories, mainly similiraty measures baed on RMSDS and pairwise distances.
Author: Niklaus Johner (niklaus.johner@unibas.ch)
- AverageDistanceMatrixFromTraj(t, sele, first=0, last=-1)¶
This function calcultes the distance between each pair of atoms in sele, averaged over the trajectory t.
- Parameters:
t (
CoordGroupHandle
) – the trajectorysele (
EntityView
) – the selection used to determine the atom pairsfirst (
int
) – the first frame of t to be usedlast (
int
) – the last frame of t to be used
- Returns:
a numpy N_{pairs}xN_{pairs} matrix, where N_{pairs} is the number of atom pairs in sele.
- DistRMSDFromTraj(t, sele, ref_sele, radius=7.0, average=False, seq_sep=4, first=0, last=-1)¶
This function calculates the distance RMSD from a trajectory. The distances selected for the calculation are all the distances between pair of atoms from residues that are at least seq_sep apart in the sequence and that are smaller than radius in ref_sel. The number and order of atoms in ref_sele and sele should be the same.
- Parameters:
t (
CoordGroupHandle
) – the trajectorysele (
EntityView
) – the selection used to calculate the distance RMSDref_sele (
EntityView
) – the reference selection used to determine the atom pairs and reference distancesradius (
float
) – the upper limit of distances in ref_sele considered for the calculationseq_sep (
int
) – the minimal sequence separation between atom pairs considered for the calculationaverage (
bool
) – use the average distance in the trajectory as reference instead of the distance obtained from ref_selefirst (
int
) – the first frame of t to be usedlast (
int
) – the last frame of t to be used
- Returns:
a numpy vecor dist_rmsd(N_{frames}).
- DistanceMatrixFromPairwiseDistances(distances, p=2)¶
This function calculates an distance matrix M(N_{frames}xN_{frames}) from the pairwise distances matrix D(N_{pairs}xN_{frames}), where N_{frames} is the number of frames in the trajectory and N_{pairs} the number of atom pairs. M[i,j] is the distance between frame i and frame j calculated as a p-norm of the differences in distances from the two frames (distance-RMSD for p=2).
- Parameters:
distances – a pairwise distance matrix as obtained from
PairwiseDistancesFromTraj()
p – exponent used for the p-norm.
- Returns:
a numpy N_{frames}xN_{frames} matrix, where N_{frames} is the number of frames.
- PairwiseDistancesFromTraj(t, sele, first=0, last=-1, seq_sep=1)¶
This function calculates the distances between any pair of atoms in sele with sequence separation larger than seq_sep from a trajectory t. It return a matrix containing one line for each atom pair and N_{frames} columns, where N_{frames} is the number of frames in the trajectory.
- Parameters:
t (
CoordGroupHandle
) – the trajectorysele (
EntityView
) – the selection used to determine the atom pairsfirst (
int
) – the first frame of t to be usedlast (
int
) – the last frame of t to be usedseq_sep (
int
) – The minimal sequence separation between atom pairs
- Returns:
a numpy N_{pairs}xN_{frames} matrix.
- RMSD_Matrix_From_Traj(t, sele, first=0, last=-1, align=True, align_sele=None)¶
This function calculates a matrix M such that M[i,j] is the RMSD (calculated on sele) between frames i and j of the trajectory t aligned on sele.
- Parameters:
t (
CoordGroupHandle
) – the trajectorysele (
EntityView
) – the selection used for alignment and RMSD calculationfirst (
int
) – the first frame of t to be usedlast (
int
) – the last frame of t to be used
- Returns:
Returns a numpy N_{frames}xN_{frames} matrix, where N_{frames} is the number of frames.