X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cluster.hpp;h=26a01b9389778fea2e2b1067a1738c75027ad7f2;hb=541bab1dac00688b4c3a8c4a95ab464412663c50;hp=aa517a057400e09cdca593f4db1e2559dca74972;hpb=edd8b9d9392a99e0b1527507de3a4ca8fabfc1c6;p=mothur.git diff --git a/cluster.hpp b/cluster.hpp index aa517a0..26a01b9 100644 --- a/cluster.hpp +++ b/cluster.hpp @@ -1,50 +1,44 @@ #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, string); + Cluster(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string); + 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; + ull smallRow; + ull smallCol; float smallDist; 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; @@ -54,33 +48,33 @@ protected: class CompleteLinkage : public Cluster { public: - CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string); - 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, string); - 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, string); - bool updateDistance(MatData& colCell, MatData& rowCell); + AverageLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string); + bool updateDistance(PDistCell& colCell, PDistCell& rowCell); string getTag(); private: @@ -89,15 +83,15 @@ private: int rowBin; int colBin; int totalBin; - + }; /***********************************************************************/ class WeightedLinkage : public Cluster { public: - WeightedLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string); - bool updateDistance(MatData& colCell, MatData& rowCell); + WeightedLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string); + bool updateDistance(PDistCell& colCell, PDistCell& rowCell); string getTag(); private: @@ -107,4 +101,6 @@ private: /***********************************************************************/ + + #endif