1 #ifndef GETOTUREPCOMMAND_H
2 #define GETOTUREPCOMMAND_H
7 * Created by Sarah Westcott on 4/6/09.
8 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
12 /* The get.oturep command outputs a .fastarep file for each distance you specify, selecting one OTU representative for each bin. */
14 #include "command.hpp"
15 #include "listvector.hpp"
16 #include "inputdata.h"
19 #include "readmatrix.hpp"
20 #include "formatmatrix.h"
22 typedef list<PCell>::iterator MatData;
23 typedef map<int, float> SeqMap;
32 repStruct(string n, int b, int s, string g) : name(n), bin(b), size(s), group(g) {}
36 class GetOTURepCommand : public Command {
39 GetOTURepCommand(string);
43 vector<string> setParameters();
44 string getCommandName() { return "get.oturep"; }
45 string getCommandCategory() { return "OTU-Based Approaches"; }
46 string getHelpString();
47 string getCitation() { return "http://www.mothur.org/wiki/Get.oturep"; }
48 string getDescription() { return "gets a representative sequence for each OTU"; }
52 void help() { m->mothurOut(getHelpString()); }
60 ReadMatrix* readMatrix;
61 FormatMatrix* formatMatrix;
62 NameAssignment* nameMap;
63 string filename, fastafile, listfile, namefile, groupfile, label, sorted, phylipfile, columnfile, distFile, format, outputDir, groups;
65 ifstream in, inNames, inRow;
66 bool abort, allLines, groupError, large, weighted;
67 set<string> labels; //holds labels to be used
68 map<string, int> nameToIndex; //maps sequence name to index in sparsematrix
69 map<string, string> nameFileMap;
70 vector<string> outputNames, Groups;
71 map<string, string> outputNameFiles;
74 vector<SeqMap> seqVec; // contains maps with sequence index and distance
75 // for all distances related to a certain sequence
76 vector<int> rowPositions;
79 void readNamesFile(bool);
80 int process(ListVector*);
82 string findRep(vector<string>); // returns the name of the "representative" sequence of given bin or subset of a bin, for groups
83 int processNames(string, string);
84 int processFastaNames(string, string);