]> git.donarmstrong.com Git - mothur.git/blob - getoturepcommand.h
sffinfo bug with flow grams right index when clipQualRight=0
[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 "listvector.hpp"
16 #include "inputdata.h"
17 #include "fastamap.h"
18 #include "groupmap.h"
19 #include "readmatrix.hpp"
20 #include "formatmatrix.h"
21 #include "counttable.h"
22
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         ~GetOTURepCommand(){}
42         
43         vector<string> setParameters();
44         string getCommandName()                 { return "get.oturep";                          }
45         string getCommandCategory()             { return "OTU-Based Approaches";        }
46         
47         string getHelpString(); 
48     string getOutputPattern(string);    
49         string getCitation() { return "http://www.mothur.org/wiki/Get.oturep"; }
50         string getDescription()         { return "gets a representative sequence for each OTU"; }
51
52         
53         int execute(); 
54         void help() { m->mothurOut(getHelpString()); }  
55         
56         
57 private:
58         ListVector* list;
59         InputData* input;
60         FastaMap* fasta;
61         GroupMap* groupMap;
62         ReadMatrix* readMatrix;
63         FormatMatrix* formatMatrix;
64         NameAssignment* nameMap;
65     CountTable ct;
66         string filename, fastafile, listfile, namefile, groupfile, label, sorted, phylipfile, countfile, columnfile, distFile, format, outputDir, groups;
67         ofstream out;
68         ifstream in, inNames, inRow;
69         bool abort, allLines, groupError, large, weighted, hasGroups;
70         set<string> labels; //holds labels to be used
71         map<string, int> nameToIndex;  //maps sequence name to index in sparsematrix
72         map<string, string> nameFileMap;
73         vector<string> outputNames, Groups;
74         map<string, string> outputNameFiles;
75         float cutoff;
76         int precision;
77         vector<SeqMap> seqVec;                  // contains maps with sequence index and distance
78                                                                         // for all distances related to a certain sequence
79         vector<int> rowPositions;
80
81         void readNamesFile();
82         void readNamesFile(bool);
83         int process(ListVector*);
84         SeqMap getMap(int);
85         string findRep(vector<string>, string);         // returns the name of the "representative" sequence of given bin or subset of a bin, for groups
86         int processNames(string, string);
87         int processFastaNames(string, string);
88     int readDist();
89 };
90
91 #endif
92