]> git.donarmstrong.com Git - mothur.git/blobdiff - cluster.hpp
Thallinger changes to cluster command.
[mothur.git] / cluster.hpp
index de86f85502efc3b6416f5877102c16ca9e5694be..99d8b7d557a41cef684ad2f9aae7d636d621bbc7 100644 (file)
@@ -7,18 +7,22 @@
 
 class RAbundVector;
 class ListVector;
-class SparseMatrix;
 
-typedef list<PCell>::iterator MatData;
+typedef vector<MatData> MatVec;
 
 class Cluster {
        
 public:
        Cluster(RAbundVector*, ListVector*, SparseMatrix*);
-       virtual void update() = 0;
-       
+    virtual void update();
+       virtual string getTag() = 0;
+
 protected:     
        void getRowColCells();
+    void removeCell(const MatData& cell, int vrow, int vcol, bool rmMatrix=true);
+
+       virtual bool updateDistance(MatData& colCell, MatData& rowCell) = 0;
+
        virtual void clusterBins();
        virtual void clusterNames();
        
@@ -29,8 +33,10 @@ protected:
        int smallRow;
        int smallCol;
        float smallDist;
-       vector<MatData> rowCells;
-       vector<MatData> colCells;
+       
+       vector<MatVec> seqVec;          // contains vectors of cells related to a certain sequence\r
+       MatVec rowCells;
+       MatVec colCells;
        ull nRowCells;
        ull nColCells;
 };
@@ -40,7 +46,8 @@ protected:
 class CompleteLinkage : public Cluster {
 public:
        CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
                
@@ -51,7 +58,9 @@ private:
 class SingleLinkage : public Cluster {
 public:
        SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+    void update();
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
                
@@ -62,10 +71,16 @@ private:
 class AverageLinkage : public Cluster {
 public:
        AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
-               
+       int saveRow;
+       int saveCol;
+       int rowBin;
+       int colBin;
+       int totalBin;
+
 };
 
 /***********************************************************************/