]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
added logfile feature
[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 "sparsematrix.hpp"
17 #include "listvector.hpp"
18 #include "inputdata.h"
19 #include "readotu.h"
20 #include "fastamap.h"
21 #include "groupmap.h"
22
23 typedef list<PCell>::iterator MatData;
24 typedef map<int, float> SeqMap;
25
26 class GetOTURepCommand : public Command {
27
28 public:
29         GetOTURepCommand(string);
30         ~GetOTURepCommand();
31         int execute();
32         void help();
33
34 private:
35         GlobalData* globaldata;
36         SparseMatrix* matrix;
37         ListVector* list;
38         ReadOTUFile* read;
39         InputData* input;
40         FastaMap* fasta;
41         GroupMap* groupMap;
42         string filename, fastafile, listfile, namesfile, groupfile, line, label;
43         ofstream out;
44         ifstream in, inNames;
45         bool groupError;
46
47         bool abort, allLines;
48         set<int> lines; //hold lines to be used
49         set<string> labels; //holds labels to be used
50         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
51
52         vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
53                                                                         // for all distances related to a certain sequence
54
55
56         void readNamesFile();
57         int process(ListVector*);
58         string findRep(int, string&, ListVector*, int&);        // returns the name of the "representative" sequence of given bin, 
59                                                                         // fills a string containing the groups in that bin if a groupfile is given,
60                                                                         // and returns the number of sequences in the given bin
61
62 };
63
64 #endif
65