]> git.donarmstrong.com Git - mothur.git/blobdiff - hcluster.h
added warning about average neighbor merges around cutoff. fixed little bugs.
[mothur.git] / hcluster.h
index ff02b1caff85b8fc48757d3d2b018b3b997ff7f4..bff432892144bfc0caa3f52f9cdd2691a605e72a 100644 (file)
 
 
 #include "mothur.h"
+#include "nameassignment.hpp"
 
 class RAbundVector;
 class ListVector;
-/************************************************************/
-struct clusterNode {
-       int numSeq;
-       int parent;
-       int smallChild; //used to make linkTable work with list and rabund. represents bin number of this cluster node
-       clusterNode(int num, int par, int kid) : numSeq(num), parent(par), smallChild(kid) {};
+
+/***********************************************************************/
+struct linkNode {
+       int     links;
+       float dist;
+       
+       linkNode() {};
+       linkNode(int l, float a) : links(l), dist(a) {};
+       ~linkNode() {};
 };
 
 /***********************************************************************/
 class HCluster {
        
 public:
-       HCluster(RAbundVector*, ListVector*);
+       HCluster(RAbundVector*, ListVector*, string, string, NameAssignment*, float);
+       ~HCluster(){};
     bool update(int, int, float);
-       //string getTag();
+       void setMapWanted(bool m); 
+       map<string, int> getSeqtoBin()  {  return seq2Bin;      }
+       vector<seqDist> getSeqs();
 
 protected:     
        void clusterBins();
@@ -38,21 +45,40 @@ protected:
        int makeActive();
        void printInfo();
        void updateArrayandLinkTable();
+       void updateMap();
+       vector<seqDist> getSeqsFNNN();
+       vector<seqDist> getSeqsAN();
+       void combineFile();
+       void processFile();
+       seqDist getNextDist(char*, int&, int);
                
        RAbundVector* rabund;
        ListVector* list;
+       NameAssignment* nameMap;
        
        vector<clusterNode> clusterArray;
+       
+       //note: the nearest and average neighbor method do not use the link table or active links
        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
        map<int, int> activeLinks;  //maps sequence to index in linkTable
        map<int, int>::iterator it;
+       map<int, int>::iterator itActive;
+       map<int, int>::iterator it2Active;
        map<int, int>::iterator it2;
        
        int numSeqs;
-       
        int smallRow;
        int smallCol;
-       float smallDist;
+       float smallDist, cutoff;
+       map<string, int> seq2Bin;
+       bool mapWanted, exitedBreak;
+       seqDist next;
+       string method, distfile;
+       ifstream filehandle;
+       
+       vector<seqDist> mergedMin;
+       string partialDist;
+       
        
 };