]> git.donarmstrong.com Git - mothur.git/blobdiff - cluster.hpp
added modify names parameter to set.dir
[mothur.git] / cluster.hpp
index 685c843c0199b73083f7eb3a17693b33fe1a4d36..dff55e61fcf7b571da5c0b895a5f46910f58f8c6 100644 (file)
@@ -2,82 +2,79 @@
 #define CLUSTER_H
 
 
+
 #include "mothur.h"
-#include "sparsematrix.hpp"
+#include "sparsedistancematrix.h"
+#include "mothurout.h"
 
 class RAbundVector;
 class ListVector;
 
-typedef vector<MatData> MatVec;
-
 class Cluster {
        
 public:
-       Cluster(RAbundVector*, ListVector*, SparseMatrix*, float);
+       Cluster(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+    virtual ~Cluster() {}
     virtual void update(double&);                              
        virtual string getTag() = 0;
        virtual void setMapWanted(bool m);  
        virtual map<string, int> getSeqtoBin()  {  return seq2Bin;      }
-
-protected:     
-       void getRowColCells();
-    void removeCell(const MatData& cell, int vrow, int vcol, bool rmMatrix=true);
-
-       virtual bool updateDistance(MatData& colCell, MatData& rowCell) = 0;
-
+    
+protected:         
+       virtual bool updateDistance(PDistCell& colCell, PDistCell& rowCell) = 0;
+    
        virtual void clusterBins();
        virtual void clusterNames();
        virtual void updateMap();
        
        RAbundVector* rabund;
        ListVector* list;
-       SparseMatrix* dMatrix;  
+       SparseDistanceMatrix* dMatrix;  
        
-       int smallRow;
-       int smallCol;
+       ull smallRow;
+       ull smallCol;
        float smallDist;
        bool mapWanted;
        float cutoff;
        map<string, int> seq2Bin;
+       string method;
        
-       vector<MatVec> seqVec;          // contains vectors of cells related to a certain sequence
-       MatVec rowCells;
-       MatVec colCells;
        ull nRowCells;
        ull nColCells;
+       MothurOut* m;
 };
 
 /***********************************************************************/
 
 class CompleteLinkage : public Cluster {
 public:
-       CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
-       bool updateDistance(MatData& colCell, MatData& rowCell);
+       CompleteLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+       bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
        string getTag();
        
 private:
-               
+    
 };
 
 /***********************************************************************/
 
 class SingleLinkage : public Cluster {
 public:
-       SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
-    void update();
-       bool updateDistance(MatData& colCell, MatData& rowCell);
+       SingleLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+    void update(double&);
+       bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
        string getTag();
        
 private:
-               
+    
 };
 
 /***********************************************************************/
 
 class AverageLinkage : public Cluster {
 public:
-       AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
-       bool updateDistance(MatData& colCell, MatData& rowCell);
+       AverageLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+       bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
        string getTag();
        
 private:
@@ -86,9 +83,24 @@ private:
        int rowBin;
        int colBin;
        int totalBin;
+    
+};
+
+/***********************************************************************/
 
+class WeightedLinkage : public Cluster {
+public:
+       WeightedLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+       bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
+       string getTag();
+       
+private:
+       int saveRow;
+       int saveCol;    
 };
 
 /***********************************************************************/
 
+
+
 #endif