]> git.donarmstrong.com Git - mothur.git/blobdiff - cluster.hpp
added warning about merging with something above cutoff to cluster. working on chimeras
[mothur.git] / cluster.hpp
index a6730275c92b35b15c9a2a091894086b0cf60a45..6d7fc470e91eca8dae548ffb5594a4099a203f35 100644 (file)
@@ -1,31 +1,33 @@
 #ifndef CLUSTER_H
 #define CLUSTER_H
 
-using namespace std;
 
-#include <iostream>
-#include <list>
-
-#include "utilities.hpp"
+#include "mothur.h"
 #include "sparsematrix.hpp"
-#include "rabundvector.hpp"
 
 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;
-       
+       Cluster(RAbundVector*, ListVector*, SparseMatrix*, float, string);
+    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;
+
        virtual void clusterBins();
        virtual void clusterNames();
+       virtual void updateMap();
        
        RAbundVector* rabund;
        ListVector* list;
@@ -34,8 +36,14 @@ protected:
        int smallRow;
        int smallCol;
        float smallDist;
-       vector<MatData> rowCells;
-       vector<MatData> colCells;
+       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;
 };
@@ -44,8 +52,9 @@ protected:
 
 class CompleteLinkage : public Cluster {
 public:
-       CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+       CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
                
@@ -55,8 +64,10 @@ private:
 
 class SingleLinkage : public Cluster {
 public:
-       SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+       SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
+    void update();
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
                
@@ -66,11 +77,17 @@ private:
 
 class AverageLinkage : public Cluster {
 public:
-       AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*);
-       void update();
+       AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
+       bool updateDistance(MatData& colCell, MatData& rowCell);
+       string getTag();
        
 private:
-               
+       int saveRow;
+       int saveCol;
+       int rowBin;
+       int colBin;
+       int totalBin;
+
 };
 
 /***********************************************************************/