]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
created mothurOut class to handle logfiles
[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         int execute();
44         void help();
45
46 private:
47         GlobalData* globaldata;
48         ListVector* list;
49         ReadOTUFile* read;
50         InputData* input;
51         FastaMap* fasta;
52         GroupMap* groupMap;
53         ReadMatrix* readMatrix;
54         FormatMatrix* formatMatrix;
55         NameAssignment* nameMap;
56         string filename, fastafile, listfile, namefile, groupfile, label, sorted, phylipfile, columnfile, distFile, format, outputDir;
57         ofstream out;
58         ifstream in, inNames, inRow;
59         bool abort, allLines, groupError, large;
60         set<string> labels; //holds labels to be used
61         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
62         vector<string> outputNames;
63         float cutoff;
64         int precision;
65         vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
66                                                                         // for all distances related to a certain sequence
67         vector<int> rowPositions;
68
69         void readNamesFile();
70         int process(ListVector*);
71         SeqMap getMap(int);
72         string findRep(int, string&, ListVector*, int&);        // returns the name of the "representative" sequence of given bin, 
73                                                                         // fills a string containing the groups in that bin if a groupfile is given,
74                                                                         // and returns the number of sequences in the given bin
75
76 };
77
78 #endif
79