de.unibi.techfak.jpredictor.clustering
Class ForwardClustering

java.lang.Object
  extended by de.unibi.techfak.jpredictor.clustering.Clustering
      extended by de.unibi.techfak.jpredictor.clustering.ForwardClustering

public class ForwardClustering
extends Clustering

This agglomerative clustering strategy builds up clusters beforehand, and decides by means of the threshold whether a cluster can be accepted or not. Nevertheless, of all accepted clusters the best is built first (like in the greedy approach).


Field Summary
(package private)  double[][] forwardRelation
           The values of the forward relation measure.
(package private)  double lastRelation
          The normalized overall-in-cluster relation measure from the last clustering step.
 
Fields inherited from class de.unibi.techfak.jpredictor.clustering.Clustering
clusters, comm, consensus, mma, n, nucleotideVector, sma
 
Constructor Summary
ForwardClustering(ICommunicator comm, SingleMotifAlignment sma, MultiMotifAlignment mma)
          Inits the forward clustering.
 
Method Summary
(package private)  void clusterStep()
          The second step in the clustering loop.
private  double computeInClusterRelation(Motif m, MotifList ml)
          Computes the in-cluster relationship, which is the summed-up relation measure of all motifs in the cluster against their representative.
(package private)  void initClustering()
          Inits the clustering.
(package private)  boolean stopTest(double threshold, int clusternumber)
          The first step in the clustering loop.
 
Methods inherited from class de.unibi.techfak.jpredictor.clustering.Clustering
alignMotifs, outputResults, setMotifList, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forwardRelation

double[][] forwardRelation

The values of the forward relation measure. The values in here reflect the relation measure in case the two clusters would have been combined. The diagonal values (row index equal to column index) have a special meaning here as they reflect the relation measure for the corresponding cluster.

Let the number of motifs in the motif list be n. Then the length of the matrix would be n. Its arrays vary in length. The first, with index zero, has length 1. The second, index 1, has length 2, and so forth. The last array, index n-1, has length n. The matrix is therefore build up as a triangle. If two clusters are combined to one their respective row and column entries are deleted. Unused entries, or invalid entries, are set to null (Double.NaN ).


lastRelation

double lastRelation
The normalized overall-in-cluster relation measure from the last clustering step. If the distance to the measure now is greater the threshold, clustering stops.

Constructor Detail

ForwardClustering

public ForwardClustering(ICommunicator comm,
                         SingleMotifAlignment sma,
                         MultiMotifAlignment mma)
                  throws java.lang.NullPointerException
Inits the forward clustering. Simply calls the constructor from the Clustering class.

Throws:
java.lang.NullPointerException
Method Detail

computeInClusterRelation

private double computeInClusterRelation(Motif m,
                                        MotifList ml)
Computes the in-cluster relationship, which is the summed-up relation measure of all motifs in the cluster against their representative. The representative is m. One such relation measure is calculated by aligning the representative, m, against one motif. The results from all alignments are combined and returned.

Parameters:
m - The representative of the cluster.
ml - The cluster consisting of several motifs.
Returns:
The relation measure of the representative against all motifs of the cluster.

initClustering

void initClustering()
Description copied from class: Clustering
Inits the clustering. It may mean, that all distances between every two motifs are calculated or such. This method is the first in start(double, int) to be called.

Specified by:
initClustering in class Clustering
See Also:
Clustering.start(double, int)

clusterStep

void clusterStep()
           throws java.lang.IllegalStateException
Description copied from class: Clustering
The second step in the clustering loop. It may mean to select two clusters which get combined, to combine them and to calculate the relation measure to all other clusters

Specified by:
clusterStep in class Clustering
Throws:
java.lang.IllegalStateException - If a clustering could not be performed due to some reason.

stopTest

boolean stopTest(double threshold,
                 int clusternumber)
Description copied from class: Clustering
The first step in the clustering loop. It may mean to check for the distances between clusters to exceed a certain threshold or for loglikelihoods to get to worse.

Specified by:
stopTest in class Clustering
Parameters:
threshold - The threshold to end the clustering. Might be Double.NaN to indicate, that the clustering should continue fully.
clusternumber - The number of clusters wished. Give zero or -1 to have a full clustering.
Returns:
true if the clustering has to stop, false otherwise.