#ifndef CLUSTER_H
#define CLUSTER_H
-using namespace std;
+
#include "mothur.h"
-#include "sparsematrix.hpp"
+#include "sparsedistancematrix.h"
+#include "mothurout.h"
class RAbundVector;
class ListVector;
-class SparseMatrix;
-
-typedef list<PCell>::iterator MatData;
class Cluster {
public:
- Cluster(RAbundVector*, ListVector*, SparseMatrix*);
- virtual void update() = 0;
-
-protected:
- void getRowColCells();
+ 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:
+ 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;
- vector<MatData> rowCells;
- vector<MatData> colCells;
+ bool mapWanted;
+ float cutoff;
+ map<string, int> seq2Bin;
+ string method;
+
ull nRowCells;
ull nColCells;
+ MothurOut* m;
};
/***********************************************************************/
class CompleteLinkage : public Cluster {
public:
- CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*);
- void update();
+ CompleteLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+ bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
+ string getTag();
private:
-
+
};
/***********************************************************************/
class SingleLinkage : public Cluster {
public:
- SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*);
- void update();
+ 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*);
- void update();
+ AverageLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
+ bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
+ string getTag();
private:
-
+ int saveRow;
+ int saveCol;
+ 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