X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=cluster.hpp;h=23a3d97f26db6087adcf1dee3c015e581e06321c;hp=208ccbfe1ba45ba70d152ba4c5ff12b50182d4dc;hb=615301e57c25e241356a9c2380648d117709458d;hpb=bfbc55964f1977da72c2cea984288a427d370a59 diff --git a/cluster.hpp b/cluster.hpp index 208ccbf..23a3d97 100644 --- a/cluster.hpp +++ b/cluster.hpp @@ -1,76 +1,106 @@ #ifndef CLUSTER_H #define CLUSTER_H -using namespace std; +//test change #include "mothur.h" -#include "utilities.hpp" -#include "sparsematrix.hpp" -#include "rabundvector.hpp" +#include "sparsedistancematrix.h" +#include "mothurout.h" class RAbundVector; class ListVector; -class SparseMatrix; - -typedef list::iterator MatData; class Cluster { public: - Cluster(RAbundVector*, ListVector*, SparseMatrix*); - virtual void update() = 0; - -protected: - void getRowColCells(); + Cluster(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string, float); + virtual ~Cluster() {} + virtual void update(double&); + virtual string getTag() = 0; + virtual void setMapWanted(bool m); + virtual map 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; + + ull smallRow; + ull smallCol; + float smallDist, adjust; + bool mapWanted; + float cutoff; + map seq2Bin; + string method; - int smallRow; - int smallCol; - float smallDist; - vector rowCells; - vector colCells; ull nRowCells; ull nColCells; + MothurOut* m; }; /***********************************************************************/ class CompleteLinkage : public Cluster { public: - CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*); - void update(); + CompleteLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string, float); + 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, float); + 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, float); + 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, float); + bool updateDistance(PDistCell& colCell, PDistCell& rowCell); + string getTag(); private: - + int saveRow; + int saveCol; }; /***********************************************************************/ + + #endif