de.unibi.techfak.jpredictor.clustering
Class GreedyClustering

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

public class GreedyClustering
extends Clustering

This agglomerative clustering strategy builds up clusters by means of the optimal relation between any two consensus motifs.


Field Summary
(package private)  double[][] alignmentResults
           Contains the results of all alignments in-between cluster representatives.
 
Fields inherited from class de.unibi.techfak.jpredictor.clustering.Clustering
clusters, comm, consensus, mma, n, nucleotideVector, sma
 
Constructor Summary
GreedyClustering(ICommunicator comm, SingleMotifAlignment sma, MultiMotifAlignment mma)
          Inits the greedy clustering.
 
Method Summary
(package private)  void clusterStep()
          The second step in the clustering loop.
(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

alignmentResults

double[][] alignmentResults

Contains the results of all alignments in-between cluster representatives.

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 ).

Constructor Detail

GreedyClustering

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

Throws:
java.lang.NullPointerException
Method Detail

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.