]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
added sorted parameter to get.oturep, added error checking to chimera classes in...
[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 struct repStruct {
27                 string name;
28                 int     bin;
29                 int size;
30                 string group;
31                 
32                 repStruct(){}
33                 repStruct(string n, int b, int s, string g) : name(n), bin(b), size(s), group(g) {}
34                 ~repStruct() {}
35 };
36
37 class GetOTURepCommand : public Command {
38
39 public:
40         GetOTURepCommand(string);
41         ~GetOTURepCommand();
42         int execute();
43         void help();
44
45 private:
46         GlobalData* globaldata;
47         SparseMatrix* matrix;
48         ListVector* list;
49         ReadOTUFile* read;
50         InputData* input;
51         FastaMap* fasta;
52         GroupMap* groupMap;
53         string filename, fastafile, listfile, namesfile, groupfile, label, sorted;
54         ofstream out;
55         ifstream in, inNames;
56         bool groupError;
57
58         bool abort, allLines;
59         set<string> labels; //holds labels to be used
60         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
61
62         vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
63                                                                         // for all distances related to a certain sequence
64
65
66         void readNamesFile();
67         int process(ListVector*);
68         string findRep(int, string&, ListVector*, int&);        // returns the name of the "representative" sequence of given bin, 
69                                                                         // fills a string containing the groups in that bin if a groupfile is given,
70                                                                         // and returns the number of sequences in the given bin
71
72 };
73
74 #endif
75