]> git.donarmstrong.com Git - mothur.git/blob - nmdscommand.h
added command descriptions
[mothur.git] / nmdscommand.h
1 #ifndef NMDSCOMMAND_H
2 #define NMDSCOMMAND_H
3
4 /*
5  *  nmdscommand.h
6  *  mothur
7  *
8  *  Created by westcott on 1/11/11.
9  *  Copyright 2011 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "command.hpp"
14 #include "linearalgebra.h"
15
16
17 /*  
18  Translated from the nmds.R code written by Sarah Goslee using,
19  
20  # Non-metric multidimensional scaling function
21  # using the majorization algorithm from
22  # Borg & Groenen 1997, Modern Multidimensional Scaling.
23  #
24  
25  # also referenced (Kruskal 1964)
26  
27  */
28
29 /*****************************************************************/
30 class NMDSCommand : public Command {
31         
32 public:
33         NMDSCommand(string);    
34         NMDSCommand();
35         ~NMDSCommand(){}
36         
37         vector<string> setParameters();
38         string getCommandName()                 { return "nmds";                                        }
39         string getCommandCategory()             { return "Hypothesis Testing";          }
40         string getHelpString(); 
41         string getCitation() { return "Borg, Groenen (1997). Non-metric multidimensional scaling function using the majorization algorithm, in Modern Multidimensional Scaling. Ed. T.F. Cox and M.A.A. Cox. Chapman and Hall. \nhttp://www.mothur.org/wiki/Nmds"; }
42         string getDescription()         { return "nmds"; }
43
44         int execute();
45         void help() { m->mothurOut(getHelpString()); }
46         
47 private:
48         
49         bool abort;
50         string phylipfile, outputDir, axesfile;
51         int maxdim, mindim, maxIters, iters;
52         double epsilon;
53         vector<string> outputNames;
54         LinearAlgebra linearCalc;
55         
56         vector< vector<double> > nmdsCalc(vector< vector<double> >&, vector< vector<double> >&, double&);
57         vector< vector<double> > getConfiguration(vector< vector<double> >&, int);
58         vector< vector<double> > generateStartingConfiguration(int, int); //pass in numNames, return axes
59         int normalizeConfiguration(vector< vector<double> >&, int, int);
60         double calculateStress(vector< vector<double> >&, vector< vector<double> >&);
61         vector< vector<double> > readAxes(vector<string>);
62         int output(vector< vector<double> >&, vector<string>&, ofstream&);      
63 };
64
65 /*****************************************************************/
66
67 #endif
68
69