X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=nmdscommand.h;h=92b694864a6d15f5b5dc20f176a271a7506ae6eb;hb=3914b0d6480f67df53b1e838f51c4e6155710434;hp=5e4e65596a05a91cfdc6824db1b4086303a0f8e3;hpb=d04f948b1a2a1a2984fc4a45d04403b8c121c5bc;p=mothur.git diff --git a/nmdscommand.h b/nmdscommand.h index 5e4e655..92b6948 100644 --- a/nmdscommand.h +++ b/nmdscommand.h @@ -14,8 +14,17 @@ #include "linearalgebra.h" -/* references used to make this command: "Nonmetric Multidimensional Scalling: A Numerical Method" - by J. B. Kruskal Psychometrika - Vol 29, No. 2 June 1964 */ +/* + Translated from the nmds.R code written by Sarah Goslee using, + + # Non-metric multidimensional scaling function + # using the majorization algorithm from + # Borg & Groenen 1997, Modern Multidimensional Scaling. + # + + # also referenced (Kruskal 1964) + + */ /*****************************************************************/ class NMDSCommand : public Command { @@ -23,34 +32,36 @@ class NMDSCommand : public Command { public: NMDSCommand(string); NMDSCommand(); - ~NMDSCommand(); - vector getRequiredParameters(); - vector getValidParameters(); - vector getRequiredFiles(); - map > getOutputFiles() { return outputTypes; } - int execute(); - void help(); + ~NMDSCommand(){} + + vector setParameters(); + string getCommandName() { return "nmds"; } + string getCommandCategory() { return "Hypothesis Testing"; } + + string getHelpString(); + string getOutputPattern(string); + 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"; } + string getDescription() { return "nmds"; } + + int execute(); + void help() { m->mothurOut(getHelpString()); } private: bool abort; string phylipfile, outputDir, axesfile; - int dimension, maxIters; - double step, cutoff; + int maxdim, mindim, maxIters, iters; + double epsilon; vector outputNames; - map > outputTypes; LinearAlgebra linearCalc; - vector< vector > generateStartingConfiguration(int); //pass in numNames, return axes - int normalizeConfiguration(vector< vector >&, int); - vector satisfyMonotonicity(vector); - double calculateStress(vector&, vector&, double&); - vector< vector > calculateStressGradientVector(vector&, vector&, double, double, vector< vector >&); - double calculateMagnitude(vector< vector >&); - double calculateStep(vector< vector >&, vector< vector >&, vector&); - vector< vector > calculateNewConfiguration(double, vector< vector >&, vector< vector >&); + vector< vector > nmdsCalc(vector< vector >&, vector< vector >&, double&); + vector< vector > getConfiguration(vector< vector >&, int); + vector< vector > generateStartingConfiguration(int, int); //pass in numNames, return axes + int normalizeConfiguration(vector< vector >&, int, int); + double calculateStress(vector< vector >&, vector< vector >&); vector< vector > readAxes(vector); - int output(string, string, vector< vector >&, vector&, vector&); + int output(vector< vector >&, vector&, ofstream&); }; /*****************************************************************/