Biskit :: TrajCluster :: TrajCluster :: Class TrajCluster
[hide private]
[frames] | no frames]

Class TrajCluster

source code

Instance Methods [hide private]
  __init__(self, traj, verbose=1)
  __raveled(self)
Apply current atom mask and return list of raveled frames.
  cluster(self, n_clusters, weight=1.13, converged=1e-11, aMask=None, force=0)
Calculate new clusters.
int calcClusterNumber(self, min_clst=5, max_clst=30, rmsLimit=1.0, weight=1.13, converged=1e-11, aMask=None, force=0)
Calculate the approximate number of clusters needed to pass the average intra-cluster rmsd limit.
array memberships(self)
Get degree of membership of each frame to each cluster.
[float] maxMemberships(self)
Get maximum membership value for each frame.
array centers(self)
Get 'center structure' for each cluster.
[int] centerFrames(self)
Get indices for frame nearest to each cluster center.
[[int]] memberFrames(self, threshold=0.)
Get indices of all frames belonging to each cluster.
[int] membershipSort(self, frames, cluster)
Sort given list of frame indices by their membership in cluster.
Trajectory memberTraj(self, cluster, threshold=0.)
Get trajectory with all frames belonging to this cluster, sorted by their membership-degree (highest first).
[Trajectory] memberTrajs(self, threshold=0.)
Get member Trajectories for each cluster.
float, float avgRmsd(self, cluster, aMask=None, threshold=0.)
Claculate the average pairwise rmsd (in Angstrom) for members of a cluter.
  avgRmsd2Ref(self, cluster, ref, avg=1)
Claculate the rmsd (or average rmsd) of all frames belonging to a cluster to a reference structure (in Angstrom).

Method Details [hide private]

__init__(self, traj, verbose=1)
(Constructor)

source code 
Parameters:
  • traj (Trajectory) - Trajectory to cluster (has to be fitted before hand)

__raveled(self)

source code 

Apply current atom mask and return list of raveled frames.

cluster(self, n_clusters, weight=1.13, converged=1e-11, aMask=None, force=0)

source code 

Calculate new clusters.
Parameters:
  • n_clusters (int) - number of clusters
  • weight (float (default: 1.13)) - fuzziness weigth
  • converged (float) - stop iteration if min dist changes less than converged (default: 1e-11)
  • aMask ([1|0]) - atom mask applied before clustering
  • force (1|0) - re-calculate even if parameters haven't changed (default:0)

calcClusterNumber(self, min_clst=5, max_clst=30, rmsLimit=1.0, weight=1.13, converged=1e-11, aMask=None, force=0)

source code 

Calculate the approximate number of clusters needed to pass the average intra-cluster rmsd limit.
Parameters:
  • min_clst (int) - lower limit for clusters (default: 5)
  • max_clst (int) - upper limit for clusters (default: 30 )
  • rmsLimit (float) - rmsd criteria that the average of all clusters must meet in Angstrom (default: 1.0)
  • weight (float) - fuzziness weigth (default: 1.13)
  • converged (float) - stop iteration if min dist changes less than converged (default: 1e-11)
  • force (1|0) - re-calculate even if parameters haven't changed (default: 0)
Returns: int
number of clusters
Raises:

memberships(self)

source code 

Get degree of membership of each frame to each cluster.
Returns: array
N.array( n_clusters x n_frames )

maxMemberships(self)

source code 

Get maximum membership value for each frame.
Returns: [float]
list of float

centers(self)

source code 

Get 'center structure' for each cluster.
Returns: array
N.array( n_clusters x n_atoms_masked x 3 )

centerFrames(self)

source code 

Get indices for frame nearest to each cluster center.
Returns: [int]
list of cluster center indecies

memberFrames(self, threshold=0.)

source code 

Get indices of all frames belonging to each cluster. Each frame is guaranteed to belong, at least, to the cluster for which it has its maximum membership. If threshold > 0, it can additionally pop up in other clusters.
Parameters:
  • threshold (float) - minimal cluster membership or 0 to consider only max membership (default: 0)
Returns: [[int]]
n_cluster, lst of lst of int, frame indices

membershipSort(self, frames, cluster)

source code 

Sort given list of frame indices by their membership in cluster.
Parameters:
  • frames ([int]) - list of frame indecies
  • cluster (int) - cluster number
Returns: [int]
indecies sorted by ther membership to cluster

memberTraj(self, cluster, threshold=0.)

source code 

Get trajectory with all frames belonging to this cluster, sorted by their membership-degree (highest first).
Parameters:
  • cluster (int) - cluster number
  • threshold (float) - float 0-1, minimal cluster membership, see memberFrames()
Returns: Trajectory
Trajectory with all members of a cluster, sorted by membership

memberTrajs(self, threshold=0.)

source code 

Get member Trajectories for each cluster. Frames are sorted by their membership-degree (highest first).
Parameters:
  • threshold () - float 0-1, minimal cluster membership, see memberFrames()
Returns: [Trajectory]
lst of Trajectories, with members of each cluster, sorted by membership

avgRmsd(self, cluster, aMask=None, threshold=0.)

source code 

Claculate the average pairwise rmsd (in Angstrom) for members of a cluter.
Parameters:
  • cluster (int) - cluster number
  • aMask ([1|0]) - atom mask applied before calculation
  • threshold (float) - float 0-1, minimal cluster membership, see memberTraj()
Returns: float, float
average rmsd and the standard deviation

avgRmsd2Ref(self, cluster, ref, avg=1)

source code 

Claculate the rmsd (or average rmsd) of all frames belonging to a cluster to a reference structure (in Angstrom).
Parameters:
  • cluster (int) - cluster number
  • ref (model) - reference structure
  • avg (float OR [float]) - return the average rmsd (1) OR a list with all rmsds (0) (default: 1)