]> git.donarmstrong.com Git - mothur.git/blob - hcluster.h
added hcluster command and fixed some bugs, namely one with smart distancing.
[mothur.git] / hcluster.h
1 #ifndef HCLUSTER_H
2 #define HCLUSTER_H
3
4 /*
5  *  hcluster.h
6  *  Mothur
7  *
8  *  Created by westcott on 10/13/09.
9  *  Copyright 2009 Schloss Lab. All rights reserved.
10  *
11  */
12
13
14 #include "mothur.h"
15
16 class RAbundVector;
17 class ListVector;
18 /************************************************************/
19 struct clusterNode {
20         int numSeq;
21         int parent;
22         int smallChild; //used to make linkTable work with list and rabund
23         clusterNode(int num, int par, int kid) : numSeq(num), parent(par), smallChild(kid) {};
24 };
25
26 /***********************************************************************/
27 class HCluster {
28         
29 public:
30         HCluster(RAbundVector*, ListVector*);
31     bool update(int, int, float);
32         //string getTag();
33
34 protected:      
35         void clusterBins();
36         void clusterNames();
37         int getUpmostParent(int);
38         int makeActive();
39         void printInfo();
40         void updateArrayandLinkTable();
41                 
42         RAbundVector* rabund;
43         ListVector* list;
44         
45         vector<clusterNode> clusterArray;
46         vector< map<int, int> > linkTable;  // vector of maps - linkTable[1][6] = 2  would mean sequence in spot 1 has 2 links with sequence in 6
47         map<int, int> activeLinks;  //maps sequence to index in linkTable
48         map<int, int>::iterator it;
49         map<int, int>::iterator it2;
50         
51         int numSeqs;
52         
53         int smallRow;
54         int smallCol;
55         float smallDist;
56         
57 };
58
59 /***********************************************************************/
60
61
62
63
64
65
66
67 #endif
68
69