]> git.donarmstrong.com Git - mothur.git/blob - cluster.hpp
added warning about merging with something above cutoff to cluster. working on chimeras
[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, string);
17     virtual void update(double&);                               
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         string method;
43         
44         vector<MatVec> seqVec;          // contains vectors of cells related to a certain sequence
45         MatVec rowCells;
46         MatVec colCells;
47         ull nRowCells;
48         ull nColCells;
49 };
50
51 /***********************************************************************/
52
53 class CompleteLinkage : public Cluster {
54 public:
55         CompleteLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
56         bool updateDistance(MatData& colCell, MatData& rowCell);
57         string getTag();
58         
59 private:
60                 
61 };
62
63 /***********************************************************************/
64
65 class SingleLinkage : public Cluster {
66 public:
67         SingleLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
68     void update();
69         bool updateDistance(MatData& colCell, MatData& rowCell);
70         string getTag();
71         
72 private:
73                 
74 };
75
76 /***********************************************************************/
77
78 class AverageLinkage : public Cluster {
79 public:
80         AverageLinkage(RAbundVector*, ListVector*, SparseMatrix*, float, string);
81         bool updateDistance(MatData& colCell, MatData& rowCell);
82         string getTag();
83         
84 private:
85         int saveRow;
86         int saveCol;
87         int rowBin;
88         int colBin;
89         int totalBin;
90
91 };
92
93 /***********************************************************************/
94
95 #endif