]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
added pca command
[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
22 typedef list<PCell>::iterator MatData;
23 typedef map<int, float> SeqMap;
24
25 struct repStruct {
26                 string name;
27                 int     bin;
28                 int size;
29                 string group;
30                 
31                 repStruct(){}
32                 repStruct(string n, int b, int s, string g) : name(n), bin(b), size(s), group(g) {}
33                 ~repStruct() {}
34 };
35
36 class GetOTURepCommand : public Command {
37
38 public:
39         GetOTURepCommand(string);
40         ~GetOTURepCommand();
41         int execute();
42         void help();
43
44 private:
45         GlobalData* globaldata;
46         ListVector* list;
47         ReadOTUFile* read;
48         InputData* input;
49         FastaMap* fasta;
50         GroupMap* groupMap;
51         string filename, fastafile, listfile, namesfile, groupfile, label, sorted, phylipfile, columnfile, namefile;
52         ofstream out;
53         ifstream in, inNames;
54         bool abort, allLines, groupError;
55         set<string> labels; //holds labels to be used
56         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
57
58         void readNamesFile();
59         int process(ListVector*);
60         string findRep(int, string&, ListVector*, int&);        // returns the name of the "representative" sequence of given bin, 
61                                                                         // fills a string containing the groups in that bin if a groupfile is given,
62                                                                         // and returns the number of sequences in the given bin
63
64 };
65
66 #endif
67