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 "globaldata.hpp"
16 #include "listvector.hpp"
17 #include "inputdata.h"
21 #include "readmatrix.hpp"
22 #include "formatmatrix.h"
24 typedef list<PCell>::iterator MatData;
25 typedef map<int, float> SeqMap;
34 repStruct(string n, int b, int s, string g) : name(n), bin(b), size(s), group(g) {}
38 class GetOTURepCommand : public Command {
41 GetOTURepCommand(string);
47 GlobalData* globaldata;
53 ReadMatrix* readMatrix;
54 FormatMatrix* formatMatrix;
55 NameAssignment* nameMap;
56 string filename, fastafile, listfile, namefile, groupfile, label, sorted, phylipfile, columnfile, distFile, format, outputDir;
58 ifstream in, inNames, inRow;
59 bool abort, allLines, groupError, large;
60 set<string> labels; //holds labels to be used
61 map<string, int> nameToIndex; //maps sequence name to index in sparsematrix
62 vector<string> outputNames;
63 map<string, string> outputNameFiles;
66 vector<SeqMap> seqVec; // contains maps with sequence index and distance
67 // for all distances related to a certain sequence
68 vector<int> rowPositions;
71 int process(ListVector*);
73 string findRep(int, ListVector*); // returns the name of the "representative" sequence of given bin
74 int processNames(string, string);