8 * Created by westcott on 1/11/11.
9 * Copyright 2011 Schloss Lab. All rights reserved.
13 #include "command.hpp"
14 #include "linearalgebra.h"
18 Translated from the nmds.R code written by Sarah Goslee using,
20 # Non-metric multidimensional scaling function
21 # using the majorization algorithm from
22 # Borg & Groenen 1997, Modern Multidimensional Scaling.
25 # also referenced (Kruskal 1964)
29 /*****************************************************************/
30 class NMDSCommand : public Command {
37 vector<string> setParameters();
38 string getCommandName() { return "nmds"; }
39 string getCommandCategory() { return "Hypothesis Testing"; }
40 string getOutputFileNameTag(string, string);
41 string getHelpString();
42 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"; }
43 string getDescription() { return "nmds"; }
46 void help() { m->mothurOut(getHelpString()); }
51 string phylipfile, outputDir, axesfile;
52 int maxdim, mindim, maxIters, iters;
54 vector<string> outputNames;
55 LinearAlgebra linearCalc;
57 vector< vector<double> > nmdsCalc(vector< vector<double> >&, vector< vector<double> >&, double&);
58 vector< vector<double> > getConfiguration(vector< vector<double> >&, int);
59 vector< vector<double> > generateStartingConfiguration(int, int); //pass in numNames, return axes
60 int normalizeConfiguration(vector< vector<double> >&, int, int);
61 double calculateStress(vector< vector<double> >&, vector< vector<double> >&);
62 vector< vector<double> > readAxes(vector<string>);
63 int output(vector< vector<double> >&, vector<string>&, ofstream&);
66 /*****************************************************************/