X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cluster.hpp;h=23a3d97f26db6087adcf1dee3c015e581e06321c;hb=3914b0d6480f67df53b1e838f51c4e6155710434;hp=38897c9cf0a2a2c0c95933eb7cabc8732f95839e;hpb=832d53a9dfac6b1795735eec643d8cf627b0d8e3;p=mothur.git diff --git a/cluster.hpp b/cluster.hpp index 38897c9..23a3d97 100644 --- a/cluster.hpp +++ b/cluster.hpp @@ -1,83 +1,80 @@ #ifndef CLUSTER_H #define CLUSTER_H +//test change #include "mothur.h" -#include "sparsematrix.hpp" +#include "sparsedistancematrix.h" +#include "mothurout.h" class RAbundVector; class ListVector; -typedef vector MatVec; - class Cluster { public: - Cluster(RAbundVector*, ListVector*, SparseMatrix*, float); - virtual void update(); + 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: - 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; - float smallDist; + ull smallRow; + ull smallCol; + float smallDist, adjust; bool mapWanted; float cutoff; map seq2Bin; + string method; - vector 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, float); + 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, float); + 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, float); + 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, float); + bool updateDistance(PDistCell& colCell, PDistCell& rowCell); + string getTag(); + +private: + int saveRow; + int saveCol; }; /***********************************************************************/ + + #endif