]> git.donarmstrong.com Git - mothur.git/blob - cluster.hpp
Thallinger changes to cluster command.
[mothur.git] / cluster.hpp
1 #ifndef CLUSTER_H
2 #define CLUSTER_H
3
4
5 #include "mothur.h"
6 #include "sparsematrix.hpp"
7
8 class RAbundVector;
9 class ListVector;
10
11 typedef vector<MatData> MatVec;
12
13 class Cluster {
14         
15 public:
16         Cluster(RAbundVector*, ListVector*, SparseMatrix*);
17     virtual void update();
18         virtual string getTag() = 0;
19
20 protected:      
21         void getRowColCells();
22     void removeCell(const MatData& cell, int vrow, int vcol, bool rmMatrix=true);
23
24         virtual bool updateDistance(MatData& colCell, MatData& rowCell) = 0;
25
26         virtual void clusterBins();
27         virtual void clusterNames();
28         
29         RAbundVector* rabund;
30         ListVector* list;
31         SparseMatrix* dMatrix;  
32         
33         int smallRow;
34         int smallCol;
35         float smallDist;
36         
37         vector<MatVec> seqVec;          // contains vectors of cells related to a certain sequence\r
38         MatVec rowCells;
39         MatVec colCells;
40         ull nRowCells;
41         ull nColCells;
42 };
43
44 /***********************************************************************/
45
46 class CompleteLinkage : public Cluster {
47 public:
48         CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*);
49         bool updateDistance(MatData& colCell, MatData& rowCell);
50         string getTag();
51         
52 private:
53                 
54 };
55
56 /***********************************************************************/
57
58 class SingleLinkage : public Cluster {
59 public:
60         SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*);
61     void update();
62         bool updateDistance(MatData& colCell, MatData& rowCell);
63         string getTag();
64         
65 private:
66                 
67 };
68
69 /***********************************************************************/
70
71 class AverageLinkage : public Cluster {
72 public:
73         AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*);
74         bool updateDistance(MatData& colCell, MatData& rowCell);
75         string getTag();
76         
77 private:
78         int saveRow;
79         int saveCol;
80         int rowBin;
81         int colBin;
82         int totalBin;
83
84 };
85
86 /***********************************************************************/
87
88 #endif