Package csb :: Package bio :: Package fragments :: Class FragmentCluster

[frames] | no frames]

# Class FragmentCluster

source code

    object --+
             |
            FragmentCluster

Provides clustering/filtering of the fragments, covering a common residue in the target. Clustering is done via iterative shrinking of the cluster. At each iteration, node rejection (deletion) is attempted for each node. The node rejection, causing the most significant drop in the average pairwise distance (RMSD) in the cluster, is retained. This procedure is repeated until: 1) the average pairwise RMSD drops below the `threshold` (converged), 2) the cluster gets exhausted or 3) node rejection no longer causes a drop in the average distance (not converging).

Instance Methods

__init__(self, items, threshold=1.5, connectedness=0.5) x.__init__(...) initializes x; see help(type(x)) for signature | source code

ClusterRep

centroid(self) Returns: the current representative fragment | source code

float

mean(self, skip=None) Returns: the current mean distance in the cluster | source code

reject(self, item) Remove `item` from the cluster. | source code

ClusterRep

shrink(self, minitems=2) Start automatic shrinking. | source code

bool

shrinkone(self) Shrink the cluster by a single node. | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| MIN_LENGTH = `6`

Properties
| connectedness
| count
| fragments
| items
| threshold
Inherited from `object`: `__class__`

Method Details

### __init__(self, items, threshold=1.5, connectedness=0.5)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `items` (iterable of ClusterNodes) - cluster members
  - `threshold` (float) - RMSD threshold; continue shrinking until the mean distance drops below this value (default=1.5)
  - `connectedness` (float) - when calculating centroids, consider only nodes connected to at least c% of all surviving vertices (default=0.5)
Overrides: object.__init__
  (inherited documentation)

### centroid(self)

source code

Returns: ClusterRep
  the current representative fragment

Note: the cluster rep is the node with the lowest average distance to all other nodes. If a fixed fragment exists, structurally similar to the rep, but longer, this fragment may be suggested as an alternative (see also ClusterRep).

### mean(self, skip=None)

source code

Returns: float
  the current mean distance in the cluster

### reject(self, item)

source code

Remove `item` from the cluster.

Parameters:
  - `item` (ClusterNode)
Raises:
  - `ClusterExhaustedError` - if this is the last remaining item

### shrink(self, minitems=2)

source code

Start automatic shrinking.

Parameters:
  - `minitems` (int) - absolute minimum of the number of nodes in the cluster
Returns: ClusterRep
  cluster's representative: the node with the lowest average distance to all other nodes in the cluster
Raises:
  - `ClusterExhaustedError` - if `self.count` < `minitems` and still not converged

### shrinkone(self)

source code

Shrink the cluster by a single node.

Returns: bool
  True on successful shrink, False otherwise (e.g. if already converged)
Raises:
  - `ClusterExhaustedError` - if exhausted
  - `ClusterDivergingError` - if not converging

Property Details

### connectedness

Get Method:
  unreachable.connectedness(self)

### count

Get Method:
  unreachable.count(self)

### fragments

Get Method:
  unreachable.fragments(self)

### items

Get Method:
  unreachable.items(self)

### threshold

Get Method:
  unreachable.threshold(self)
Set Method:
  unreachable.threshold(self, value)