]> git.donarmstrong.com Git - mothur.git/blob - hcluster.h
added warning about average neighbor merges around cutoff. fixed little bugs.
[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 #include "nameassignment.hpp"
16
17 class RAbundVector;
18 class ListVector;
19
20 /***********************************************************************/
21 struct linkNode {
22         int     links;
23         float dist;
24         
25         linkNode() {};
26         linkNode(int l, float a) : links(l), dist(a) {};
27         ~linkNode() {};
28 };
29
30 /***********************************************************************/
31 class HCluster {
32         
33 public:
34         HCluster(RAbundVector*, ListVector*, string, string, NameAssignment*, float);
35         ~HCluster(){};
36     bool update(int, int, float);
37         void setMapWanted(bool m); 
38         map<string, int> getSeqtoBin()  {  return seq2Bin;      }
39         vector<seqDist> getSeqs();
40
41 protected:      
42         void clusterBins();
43         void clusterNames();
44         int getUpmostParent(int);
45         int makeActive();
46         void printInfo();
47         void updateArrayandLinkTable();
48         void updateMap();
49         vector<seqDist> getSeqsFNNN();
50         vector<seqDist> getSeqsAN();
51         void combineFile();
52         void processFile();
53         seqDist getNextDist(char*, int&, int);
54                 
55         RAbundVector* rabund;
56         ListVector* list;
57         NameAssignment* nameMap;
58         
59         vector<clusterNode> clusterArray;
60         
61         //note: the nearest and average neighbor method do not use the link table or active links
62         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
63         map<int, int> activeLinks;  //maps sequence to index in linkTable
64         map<int, int>::iterator it;
65         map<int, int>::iterator itActive;
66         map<int, int>::iterator it2Active;
67         map<int, int>::iterator it2;
68         
69         int numSeqs;
70         int smallRow;
71         int smallCol;
72         float smallDist, cutoff;
73         map<string, int> seq2Bin;
74         bool mapWanted, exitedBreak;
75         seqDist next;
76         string method, distfile;
77         ifstream filehandle;
78         
79         vector<seqDist> mergedMin;
80         string partialDist;
81         
82         
83 };
84
85 /***********************************************************************/
86
87
88
89
90
91
92
93 #endif
94
95