Package org.biojava.nbio.core.util
Class SingleLinkageClusterer
java.lang.Object
org.biojava.nbio.core.util.SingleLinkageClusterer
An implementation of a single linkage clusterer
 See http://en.wikipedia.org/wiki/Single-linkage_clustering
- Author:
 - Jose Duarte
 
- 
Constructor Summary
ConstructorsConstructorDescriptionSingleLinkageClusterer(double[][] matrix, boolean isScoreMatrix) Constructs a new SingleLinkageClusterer Subsequently usegetDendrogram()to get the full tree orgetClusters(double)to get the clusters at a certain cutoff in the tree Please note that the matrix will be altered during the clustering procedure. - 
Method Summary
Modifier and TypeMethodDescriptiongetClusters(double cutoff) Get the clusters by cutting the dendrogram at given cutofforg.biojava.nbio.core.util.SingleLinkageClusterer.LinkedPair[]Get the full dendrogram (size n-1) result of the hierarchical clustering 
- 
Constructor Details
- 
SingleLinkageClusterer
public SingleLinkageClusterer(double[][] matrix, boolean isScoreMatrix) Constructs a new SingleLinkageClusterer Subsequently usegetDendrogram()to get the full tree orgetClusters(double)to get the clusters at a certain cutoff in the tree Please note that the matrix will be altered during the clustering procedure. A copy must be made before by the user if needing to use the original matrix further.- Parameters:
 matrix- the distance matrix with distance values in j>i half, all other values will be ignoredisScoreMatrix- if false the matrix will be considered a distance matrix: lower values (distances) mean closer objects, if true the matrix will be considered a score matrix: larger values (scores) mean closer objects- Throws:
 IllegalArgumentException- if matrix not square
 
 - 
 - 
Method Details
- 
getDendrogram
public org.biojava.nbio.core.util.SingleLinkageClusterer.LinkedPair[] getDendrogram()Get the full dendrogram (size n-1) result of the hierarchical clustering- Returns:
 
 - 
getClusters
Get the clusters by cutting the dendrogram at given cutoff- Parameters:
 cutoff-- Returns:
 - Map from cluster numbers to indices of the cluster members
 
 
 -