org.fhcrc.cpl.toolbox.proteomics
Class Clusterer2D

java.lang.Object
  extended by org.fhcrc.cpl.toolbox.proteomics.Clusterer2D
Direct Known Subclasses:
FeatureClusterer

public class Clusterer2D
extends java.lang.Object

_Highly_ generic 2-dimensional clusterer. Adapted from FeatureGrouper, which was specific to clustering Features by mass and scan. Arrays of Clusterables are added to a tree structure, which divides them up first by dimension1 and then by dimension2. Each Clusterable is aware of its value in both dimensions and (as far as Clusterer2D is concerned) nothing else. Any calling class will have to implement its own Clusterer class in order for clustering to have any meaning. So far so good. Here's the weird bit: we need to be able to cluster Features by mass, and the max bucket size may be in terms of Daltons or in terms of PPM. If it's in terms of Daltons, great. If ppm, then the canSplit() method has some very funky behavior. By default it behaves as you might expect, though.


Nested Class Summary
 class Clusterer2D.BucketSummary
           
static interface Clusterer2D.Clusterable
          defines values in two dimensions.
static class Clusterer2D.ClusterDimensionSplitCalculator
          abstract class for determining whether to split in each dimension.
static class Clusterer2D.DefaultClusterDimensionSplitCalculator
          Default split calculator is very simple!
static class Clusterer2D.TreeEntry
          A single entry in the clustering tree, aware of its value in only one dimension
 
Field Summary
protected  boolean _dimension1IsInt
           
protected  boolean _dimension2IsInt
           
protected  Clusterer2D.ClusterDimensionSplitCalculator _dimensionSplitCalculator
           
 
Constructor Summary
Clusterer2D()
           
Clusterer2D(Clusterer2D.Clusterable[] clusterableArray)
           
 
Method Summary
 void addSet(Clusterer2D.Clusterable[] clusterableArray)
           
 Pair<java.lang.Double,java.lang.Double> calculateBestBuckets(double[] dimension1Buckets, double[] dimension2Buckets)
           
 boolean dimension1IsInt()
           
 boolean dimension2IsInt()
           
 java.util.List<Clusterer2D.Clusterable[]> getClusterableArrays()
           
 int[] histogramBucketCounts()
           
 int[] histogramSetCounts()
           
 int numBuckets()
           
 int rowsWithOneFromEach()
           
 int rowsWithOneFromEach(Clusterer2D.BucketSummary[] bucketSummaries)
          Calculates how many buckets have exactly 1 feature from each feature set.
 void setClusterableArrays(java.util.List<Clusterer2D.Clusterable[]> clusterableArrays)
           
 void setDimension1IsInt(boolean _dimension1IsInt)
           
 void setDimension2IsInt(boolean _dimension2IsInt)
           
 void setDimensionSplitCalculator(Clusterer2D.ClusterDimensionSplitCalculator dimensionSplitCalculator)
           
 void split2D(double maxDimension1Bucket, double maxDimension2Bucket)
           
 Clusterer2D.BucketSummary[] summarize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_dimensionSplitCalculator

protected Clusterer2D.ClusterDimensionSplitCalculator _dimensionSplitCalculator

_dimension1IsInt

protected boolean _dimension1IsInt

_dimension2IsInt

protected boolean _dimension2IsInt
Constructor Detail

Clusterer2D

public Clusterer2D()

Clusterer2D

public Clusterer2D(Clusterer2D.Clusterable[] clusterableArray)
Method Detail

calculateBestBuckets

public Pair<java.lang.Double,java.lang.Double> calculateBestBuckets(double[] dimension1Buckets,
                                                                    double[] dimension2Buckets)

setDimensionSplitCalculator

public void setDimensionSplitCalculator(Clusterer2D.ClusterDimensionSplitCalculator dimensionSplitCalculator)

addSet

public void addSet(Clusterer2D.Clusterable[] clusterableArray)

split2D

public void split2D(double maxDimension1Bucket,
                    double maxDimension2Bucket)

summarize

public Clusterer2D.BucketSummary[] summarize()

histogramBucketCounts

public int[] histogramBucketCounts()

histogramSetCounts

public int[] histogramSetCounts()

numBuckets

public int numBuckets()

rowsWithOneFromEach

public int rowsWithOneFromEach()

rowsWithOneFromEach

public int rowsWithOneFromEach(Clusterer2D.BucketSummary[] bucketSummaries)
Calculates how many buckets have exactly 1 feature from each feature set. Useful for testing align

Returns:

dimension1IsInt

public boolean dimension1IsInt()

setDimension1IsInt

public void setDimension1IsInt(boolean _dimension1IsInt)

dimension2IsInt

public boolean dimension2IsInt()

setDimension2IsInt

public void setDimension2IsInt(boolean _dimension2IsInt)

getClusterableArrays

public java.util.List<Clusterer2D.Clusterable[]> getClusterableArrays()

setClusterableArrays

public void setClusterableArrays(java.util.List<Clusterer2D.Clusterable[]> clusterableArrays)


Fred Hutchinson Cancer Research Center