]> git.donarmstrong.com Git - mothur.git/blob - clustercommand.h
Merge remote-tracking branch 'mothur/master'
[mothur.git] / clustercommand.h
1 #ifndef CLUSTERCOMMAND_H
2 #define CLUSTERCOMMAND_H
3 /*
4  *  clustercommand.h
5  *  Dotur
6  *
7  *  Created by Sarah Westcott on 1/2/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 #include "command.hpp"
13 #include "rabundvector.hpp"
14 #include "sabundvector.hpp"
15 #include "listvector.hpp"
16 #include "cluster.hpp"
17 #include "sparsedistancematrix.h"
18 #include "counttable.h"
19
20 /* The cluster() command:
21         The cluster command outputs a .list , .rabund and .sabund files.  
22         The cluster command parameter options are method, cuttoff and precision. No parameters are required.  
23         The cluster command should be in the following format: cluster(method=yourMethod, cutoff=yourCutoff, precision=yourPrecision).  
24         The acceptable methods are furthest, nearest and average.  If you do not provide a method the default algorythm is furthest neighbor.  
25         The cluster() command outputs three files *.list, *.rabund, and *.sabund.   */
26
27
28 class ClusterCommand : public Command {
29         
30 public:
31         ClusterCommand(string);
32         ClusterCommand();
33         ~ClusterCommand();
34         
35         vector<string> setParameters();
36         string getCommandName()                 { return "cluster";             }
37         string getCommandCategory()             { return "Clustering";  }
38         string getOutputFileNameTag(string, string);
39         string getHelpString(); 
40         string getCitation() { return "Schloss PD, Westcott SL (2011). Assessing and improving methods used in OTU-based approaches for 16S rRNA gene sequence analysis. Appl Environ Microbiol. \nhttp://www.mothur.org/wiki/Cluster"; }
41         string getDescription()         { return "cluster your sequences into OTUs using a distance matrix"; }
42         
43         int execute(); 
44         void help() { m->mothurOut(getHelpString()); }  
45         
46 private:
47         Cluster* cluster;
48         SparseDistanceMatrix* matrix;
49         ListVector* list;
50         RAbundVector* rabund;
51         RAbundVector oldRAbund;
52         ListVector oldList;
53
54         bool abort, hard, sim;
55
56         string method, fileroot, tag, outputDir, phylipfile, columnfile, namefile, format, distfile, countfile;
57         double cutoff;
58         string showabund, timing;
59         int precision, length;
60         ofstream sabundFile, rabundFile, listFile;
61
62         bool print_start;
63         time_t start;
64         unsigned long loops;
65         
66         void printData(string label);
67         vector<string> outputNames;
68     
69     int createRabund(CountTable*&, ListVector*&, RAbundVector*&);
70 };
71
72 #endif