]> git.donarmstrong.com Git - mothur.git/blob - treegroupscommand.h
d2d6c721c72fcc5d96926fc246c31e89743dca58
[mothur.git] / treegroupscommand.h
1 #ifndef TREEGROUPCOMMAND_H
2 #define TREEGROUPCOMMAND_H
3
4 /*
5  *  treegroupscommand.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 4/8/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12  
13 #include "command.hpp"
14 #include "inputdata.h"
15 #include "groupmap.h"
16 #include "validcalculator.h"
17 #include "tree.h"
18 #include "treemap.h"
19 #include "readmatrix.hpp"
20 #include "readcolumn.h"
21 #include "readphylip.h"
22 #include "sparsematrix.hpp"
23
24
25 /* This command create a tree file for each similarity calculator at distance level, using various calculators to find the similiarity between groups. 
26         The user can select the lines or labels they wish to use as well as the groups they would like included.
27         They can also use as many or as few calculators as they wish. */
28         
29
30 typedef list<PCell>::iterator MatData;
31
32 class TreeGroupCommand : public Command {
33         
34 public:
35         TreeGroupCommand(string);       
36         TreeGroupCommand();
37         ~TreeGroupCommand();
38         
39         vector<string> setParameters();
40         string getCommandName()                 { return "tree.shared";                         }
41         string getCommandCategory()             { return "OTU-Based Approaches";        }
42         string getHelpString(); 
43         string getCitation() { return "http://www.mothur.org/wiki/Tree.shared"; }
44         string getDescription()         { return "generate a tree file that describes the dissimilarity among groups"; }
45
46         
47         int execute(); 
48         void help() { m->mothurOut(getHelpString()); }  
49         
50 private:
51         int createTree();
52         void printSims(ostream&);
53         int makeSimsShared();
54         int makeSimsDist();
55         
56         ReadMatrix* readMatrix;
57         SparseMatrix* matrix;
58         NameAssignment* nameMap;
59         ListVector* list;
60         TreeMap* tmap;
61         Tree* t;
62         vector<Calculator*> treeCalculators;
63         vector< vector<float> > simMatrix;
64         map<int, int> index;  //maps row in simMatrix to vector index in the tree       
65         InputData* input;
66         vector<SharedRAbundVector*> lookup;
67         string lastLabel;
68         string format, outputFile, groupNames, filename, sharedfile, inputfile;
69         int numGroups;
70         ofstream out;
71         float precision, cutoff;
72
73         bool abort, allLines;
74         set<string> labels; //holds labels to be used
75         string phylipfile, columnfile, namefile, calc, groups, label, outputDir;
76         vector<string>  Estimators, Groups, outputNames; //holds estimators to be used
77         
78         //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
79         int process(vector<SharedRAbundVector*>);
80         
81         
82
83 };
84         
85         
86 #endif
87
88