File: nmdscommand.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (70 lines) | stat: -rwxr-xr-x 2,019 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef NMDSCOMMAND_H
#define NMDSCOMMAND_H

/*
 *  nmdscommand.h
 *  mothur
 *
 *  Created by westcott on 1/11/11.
 *  Copyright 2011 Schloss Lab. All rights reserved.
 *
 */

#include "command.hpp"
#include "linearalgebra.h"


/*  
 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 {
	
public:
	NMDSCommand(string);	
	~NMDSCommand(){}
	
	vector<string> 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,  axesfile;
	int maxdim, mindim, maxIters, iters;
	double epsilon;
	vector<string> outputNames;
	LinearAlgebra linearCalc;
	
	vector< vector<double> > nmdsCalc(vector< vector<double> >&, vector< vector<double> >&, double&);
	vector< vector<double> > getConfiguration(vector< vector<double> >&, int);
	vector< vector<double> > generateStartingConfiguration(int, int); //pass in numNames, return axes
	int normalizeConfiguration(vector< vector<double> >&, int, int);
	double calculateStress(vector< vector<double> >&, vector< vector<double> >&);
	vector< vector<double> > readAxes(vector<string>);
	int output(vector< vector<double> >&, vector<string>&, ofstream&);	
};

/*****************************************************************/

#endif