]> git.donarmstrong.com Git - mothur.git/blob - clustercommand.h
changes while testing
[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         
39         string getHelpString(); 
40     string getOutputPattern(string);    
41         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 77:3219.\nSchloss PD, Handelsman J (2005). Introducing DOTUR, a computer program for defining operational taxonomic units and estimating species richness. Appl Environ Microbiol 71: 1501-6.\nhttp://www.mothur.org/wiki/Cluster"; }
42         string getDescription()         { return "cluster your sequences into OTUs using a distance matrix"; }
43         
44         int execute(); 
45         void help() { m->mothurOut(getHelpString()); }  
46         
47 private:
48         Cluster* cluster;
49         SparseDistanceMatrix* matrix;
50         ListVector* list;
51         RAbundVector* rabund;
52         RAbundVector oldRAbund;
53         ListVector oldList;
54
55         bool abort, hard, sim;
56
57         string method, fileroot, tag, outputDir, phylipfile, columnfile, namefile, format, distfile, countfile;
58         double cutoff;
59         string showabund, timing;
60         int precision, length;
61         ofstream sabundFile, rabundFile, listFile;
62
63         bool print_start;
64         time_t start;
65         unsigned long loops;
66         
67         void printData(string label);
68         vector<string> outputNames;
69     
70     int createRabund(CountTable*&, ListVector*&, RAbundVector*&);
71 };
72
73 #endif