]> git.donarmstrong.com Git - mothur.git/blob - cluster.hpp
added warning about average neighbor merges around cutoff. fixed little bugs.
[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*, float);
17     virtual void update();                              
18         virtual string getTag() = 0;
19         virtual void setMapWanted(bool m);  
20         virtual map<string, int> getSeqtoBin()  {  return seq2Bin;      }
21
22 protected:      
23         void getRowColCells();
24     void removeCell(const MatData& cell, int vrow, int vcol, bool rmMatrix=true);
25
26         virtual bool updateDistance(MatData& colCell, MatData& rowCell) = 0;
27
28         virtual void clusterBins();
29         virtual void clusterNames();
30         virtual void updateMap();
31         
32         RAbundVector* rabund;
33         ListVector* list;
34         SparseMatrix* dMatrix;  
35         
36         int smallRow;
37         int smallCol;
38         float smallDist;
39         bool mapWanted;
40         float cutoff;
41         map<string, int> seq2Bin;
42         
43         vector<MatVec> seqVec;          // contains vectors of cells related to a certain sequence
44         MatVec rowCells;
45         MatVec colCells;
46         ull nRowCells;
47         ull nColCells;
48 };
49
50 /***********************************************************************/
51
52 class CompleteLinkage : public Cluster {
53 public:
54         CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
55         bool updateDistance(MatData& colCell, MatData& rowCell);
56         string getTag();
57         
58 private:
59                 
60 };
61
62 /***********************************************************************/
63
64 class SingleLinkage : public Cluster {
65 public:
66         SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
67     void update();
68         bool updateDistance(MatData& colCell, MatData& rowCell);
69         string getTag();
70         
71 private:
72                 
73 };
74
75 /***********************************************************************/
76
77 class AverageLinkage : public Cluster {
78 public:
79         AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*, float);
80         bool updateDistance(MatData& colCell, MatData& rowCell);
81         string getTag();
82         
83 private:
84         int saveRow;
85         int saveCol;
86         int rowBin;
87         int colBin;
88         int totalBin;
89
90 };
91
92 /***********************************************************************/
93
94 #endif