1 #ifndef CLUSTERFRAGMENTSCOMMAND_H
2 #define CLUSTERFRAGMENTSCOMMAND_H
3 
4 /*
5  *  clusterfragmentscommand.h
6  *  Mothur
7  *
8  *  Created by westcott on 9/23/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12 
13 
14 #include "command.hpp"
15 #include "sequence.hpp"
16 #include "counttable.h"
17 
18 /************************************************************/
19 struct seqRNode {
20 	int numIdentical;
21 	int length;
22 	Sequence seq;
23 	string names;
24 	bool active;
seqRNodeseqRNode25 	seqRNode() {}
seqRNodeseqRNode26 	seqRNode(int n, Sequence s, string nm, int l) : numIdentical(n), seq(s), names(nm), active(1), length(l) {}
~seqRNodeseqRNode27 	~seqRNode() {}
28 };
29 /************************************************************/
30 
31 class ClusterFragmentsCommand : public Command {
32 
33 public:
34 	ClusterFragmentsCommand(string);
~ClusterFragmentsCommand()35 	~ClusterFragmentsCommand() {}
36 
37 	vector<string> setParameters();
getCommandName()38 	string getCommandName()			{ return "cluster.fragments";		}
getCommandCategory()39 	string getCommandCategory()		{ return "Sequence Processing";		}
40 
41 	string getHelpString();
42     string getOutputPattern(string);
getCitation()43 	string getCitation() { return "http://www.mothur.org/wiki/Cluster.fragments"; }
getDescription()44 	string getDescription()		{ return "creates a namesfile with sequences that are a fragment of a larger sequence"; }
45 
46 	int execute();
help()47 	void help() { m->mothurOut(getHelpString()); }
48 
49 private:
50     CountTable ct;
51 	bool abort;
52 	string fastafile, namefile, countfile;
53 	int diffs, percent;
54 	vector<seqRNode> alignSeqs;
55 	map<string, string> names; //represents the names file first column maps to second column
56 	map<string, int> sizes;  //this map a seq name to the number of identical seqs in the names file
57 	map<string, int>::iterator itSize;
58 	vector<string> outputNames;
59 
60 	int readFASTA();
61 	void readNameFile();
62 	void printData(string, string); //fasta filename, names file name
63 	bool isFragment(string, string);
64 
65 };
66 
67 /************************************************************/
68 
69 #endif
70 
71