]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
fixed indicator command bug
[mothur.git] / getoturepcommand.h
1 #ifndef GETOTUREPCOMMAND_H
2 #define GETOTUREPCOMMAND_H
3 /*
4  *  getoturepcommand.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 4/6/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11  
12  /* The get.oturep command outputs a .fastarep file for each distance you specify, selecting one OTU representative for each bin. */
13
14 #include "command.hpp"
15 #include "globaldata.hpp"
16 #include "listvector.hpp"
17 #include "inputdata.h"
18 #include "readotu.h"
19 #include "fastamap.h"
20 #include "groupmap.h"
21 #include "readmatrix.hpp"
22 #include "formatmatrix.h"
23
24 typedef list<PCell>::iterator MatData;
25 typedef map<int, float> SeqMap;
26
27 struct repStruct {
28                 string name;
29                 int     bin;
30                 int size;
31                 string group;
32                 
33                 repStruct(){}
34                 repStruct(string n, int b, int s, string g) : name(n), bin(b), size(s), group(g) {}
35                 ~repStruct() {}
36 };
37
38 class GetOTURepCommand : public Command {
39
40 public:
41         GetOTURepCommand(string);
42         GetOTURepCommand();
43         ~GetOTURepCommand();
44         vector<string> getRequiredParameters();
45         vector<string> getValidParameters();
46         vector<string> getRequiredFiles();
47         map<string, vector<string> > getOutputFiles() { return outputTypes; }
48         int execute();
49         void help();
50
51 private:
52         GlobalData* globaldata;
53         ListVector* list;
54         ReadOTUFile* read;
55         InputData* input;
56         FastaMap* fasta;
57         GroupMap* groupMap;
58         ReadMatrix* readMatrix;
59         FormatMatrix* formatMatrix;
60         NameAssignment* nameMap;
61         string filename, fastafile, listfile, namefile, groupfile, label, sorted, phylipfile, columnfile, distFile, format, outputDir, groups;
62         ofstream out;
63         ifstream in, inNames, inRow;
64         bool abort, allLines, groupError, large, weighted;
65         set<string> labels; //holds labels to be used
66         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
67         map<string, string> nameFileMap;
68         vector<string> outputNames, Groups;
69         map<string, string> outputNameFiles;
70         float cutoff;
71         int precision;
72         vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
73                                                                         // for all distances related to a certain sequence
74         vector<int> rowPositions;
75         map<string, vector<string> > outputTypes;
76
77         void readNamesFile();
78         void readNamesFile(bool);
79         int process(ListVector*);
80         SeqMap getMap(int);
81         string findRep(vector<string>);         // returns the name of the "representative" sequence of given bin or subset of a bin, for groups
82         int processNames(string, string);
83                                                                                                 
84
85 };
86
87 #endif
88