]> git.donarmstrong.com Git - mothur.git/blob - cluster.hpp
added sparseDistanceMatrix class. Modified cluster commands to use the new sparse...
[mothur.git] / cluster.hpp
1 #ifndef CLUSTER_H
2 #define CLUSTER_H
3
4
5
6 #include "mothur.h"
7 #include "sparsedistancematrix.h"
8 #include "mothurout.h"
9
10 class RAbundVector;
11 class ListVector;
12
13 class Cluster {
14         
15 public:
16         Cluster(RAbundVector*, ListVector*, SparseDistanceMatrix*, 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         virtual bool updateDistance(PDistCell& colCell, PDistCell& rowCell) = 0;
24     
25         virtual void clusterBins();
26         virtual void clusterNames();
27         virtual void updateMap();
28         
29         RAbundVector* rabund;
30         ListVector* list;
31         SparseDistanceMatrix* dMatrix;  
32         
33         ull smallRow;
34         ull smallCol;
35         float smallDist;
36         bool mapWanted;
37         float cutoff;
38         map<string, int> seq2Bin;
39         string method;
40         
41         ull nRowCells;
42         ull nColCells;
43         MothurOut* m;
44 };
45
46 /***********************************************************************/
47
48 class CompleteLinkage : public Cluster {
49 public:
50         CompleteLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
51         bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
52         string getTag();
53         
54 private:
55     
56 };
57
58 /***********************************************************************/
59
60 class SingleLinkage : public Cluster {
61 public:
62         SingleLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
63     void update(double&);
64         bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
65         string getTag();
66         
67 private:
68     
69 };
70
71 /***********************************************************************/
72
73 class AverageLinkage : public Cluster {
74 public:
75         AverageLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
76         bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
77         string getTag();
78         
79 private:
80         int saveRow;
81         int saveCol;
82         int rowBin;
83         int colBin;
84         int totalBin;
85     
86 };
87
88 /***********************************************************************/
89
90 class WeightedLinkage : public Cluster {
91 public:
92         WeightedLinkage(RAbundVector*, ListVector*, SparseDistanceMatrix*, float, string);
93         bool updateDistance(PDistCell& colCell, PDistCell& rowCell);
94         string getTag();
95         
96 private:
97         int saveRow;
98         int saveCol;    
99 };
100
101 /***********************************************************************/
102
103
104
105 #endif