]> git.donarmstrong.com Git - mothur.git/blob - nmdscommand.cpp
some minor changes
[mothur.git] / nmdscommand.cpp
1 /*
2  *  nmdscommand.cpp
3  *  mothur
4  *
5  *  Created by westcott on 1/11/11.
6  *  Copyright 2011 Schloss Lab. All rights reserved.
7  *
8  */
9
10 #include "nmdscommand.h"
11 #include "readphylipvector.h"
12
13 //**********************************************************************************************************************
14 vector<string> NMDSCommand::getValidParameters(){       
15         try {
16                 string Array[] =  {"phylip","axes","mindim","maxdim","iters","maxiters","epsilon","outputdir","inputdir"};
17                 vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
18                 return myArray;
19         }
20         catch(exception& e) {
21                 m->errorOut(e, "NMDSCommand", "getValidParameters");
22                 exit(1);
23         }
24 }
25 //**********************************************************************************************************************
26 NMDSCommand::NMDSCommand(){     
27         try {
28                 abort = true; calledHelp = true; 
29                 vector<string> tempOutNames;
30                 outputTypes["nmds"] = tempOutNames;
31                 outputTypes["stress"] = tempOutNames;
32                 outputTypes["iters"] = tempOutNames;
33         }
34         catch(exception& e) {
35                 m->errorOut(e, "NMDSCommand", "NMDSCommand");
36                 exit(1);
37         }
38 }
39 //**********************************************************************************************************************
40 vector<string> NMDSCommand::getRequiredParameters(){    
41         try {
42                 string Array[] =  {"phylip"};
43                 vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
44                 return myArray;
45         }
46         catch(exception& e) {
47                 m->errorOut(e, "NMDSCommand", "getRequiredParameters");
48                 exit(1);
49         }
50 }
51 //**********************************************************************************************************************
52 vector<string> NMDSCommand::getRequiredFiles(){ 
53         try {
54                 vector<string> myArray;
55                 return myArray;
56         }
57         catch(exception& e) {
58                 m->errorOut(e, "NMDSCommand", "getRequiredFiles");
59                 exit(1);
60         }
61 }
62 //**********************************************************************************************************************
63
64 NMDSCommand::NMDSCommand(string option)  {
65         try {
66                 abort = false; calledHelp = false;   
67                 
68                 //allow user to run help
69                 if(option == "help") { help(); abort = true; calledHelp = true; }
70                 
71                 else {
72                         //valid paramters for this command
73                         string Array[] =  {"phylip","axes","mindim","maxdim","iters","maxiters","epsilon","outputdir", "inputdir"};
74                         vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
75                         
76                         OptionParser parser(option);
77                         map<string, string> parameters = parser. getParameters();
78                         
79                         ValidParameters validParameter;
80                         map<string, string>::iterator it;
81                         
82                         //check to make sure all parameters are valid for command
83                         for (it = parameters.begin(); it != parameters.end(); it++) { 
84                                 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
85                         }
86                         //if the user changes the input directory command factory will send this info to us in the output parameter 
87                         string inputDir = validParameter.validFile(parameters, "inputdir", false);              
88                         if (inputDir == "not found"){   inputDir = "";          }
89                         else {
90                                 string path;
91                                 it = parameters.find("phylip");
92                                 //user has given a template file
93                                 if(it != parameters.end()){ 
94                                         path = m->hasPath(it->second);
95                                         //if the user has not given a path then, add inputdir. else leave path alone.
96                                         if (path == "") {       parameters["phylip"] = inputDir + it->second;           }
97                                 }
98                                 
99                                 it = parameters.find("axes");
100                                 //user has given a template file
101                                 if(it != parameters.end()){ 
102                                         path = m->hasPath(it->second);
103                                         //if the user has not given a path then, add inputdir. else leave path alone.
104                                         if (path == "") {       parameters["axes"] = inputDir + it->second;             }
105                                 }
106                         }
107                         
108                         //initialize outputTypes
109                         vector<string> tempOutNames;
110                         outputTypes["nmds"] = tempOutNames;
111                         outputTypes["iters"] = tempOutNames;
112                         outputTypes["stress"] = tempOutNames;
113                         
114                         //required parameters
115                         phylipfile = validParameter.validFile(parameters, "phylip", true);
116                         if (phylipfile == "not open") { phylipfile = ""; abort = true; }
117                         else if (phylipfile == "not found") { phylipfile = ""; m->mothurOut("You must provide a distance file before running the nmds command."); m->mothurOutEndLine(); abort = true; }        
118                         
119                         axesfile = validParameter.validFile(parameters, "axes", true);
120                         if (axesfile == "not open") { axesfile = ""; abort = true; }
121                         else if (axesfile == "not found") { axesfile = "";  }                           
122                         
123                         //if the user changes the output directory command factory will send this info to us in the output parameter 
124                         outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
125                                 outputDir = ""; 
126                                 outputDir += m->hasPath(phylipfile); //if user entered a file with a path then preserve it      
127                         }
128                         
129                         string temp = validParameter.validFile(parameters, "mindim", false);    if (temp == "not found") {      temp = "2";     }
130                         convert(temp, mindim);
131                         
132                         temp = validParameter.validFile(parameters, "maxiters", false); if (temp == "not found") {      temp = "500";   }
133                         convert(temp, maxIters);
134                         
135                         temp = validParameter.validFile(parameters, "iters", false);    if (temp == "not found") {      temp = "10";    }
136                         convert(temp, iters);
137                         
138                         temp = validParameter.validFile(parameters, "maxdim", false);   if (temp == "not found") {      temp = "2";     }
139                         convert(temp, maxdim);
140                         
141                         temp = validParameter.validFile(parameters, "epsilon", false);  if (temp == "not found") {      temp = "0.000000000001";        }
142                         convert(temp, epsilon); 
143                         
144                         if (mindim < 1) { m->mothurOut("mindim must be at least 1."); m->mothurOutEndLine(); abort = true; }
145                         if (maxdim < mindim) { m->mothurOut("maxdim must be greater than mindim."); m->mothurOutEndLine(); abort = true; }
146                 }
147                 
148         }
149         catch(exception& e) {
150                 m->errorOut(e, "NMDSCommand", "NMDSCommand");
151                 exit(1);
152         }
153 }
154 //**********************************************************************************************************************
155 void NMDSCommand::help(){
156         try {
157                 m->mothurOut("The nmds command is modelled after the nmds code written in R by Sarah Goslee, using Non-metric multidimensional scaling function using the majorization algorithm from Borg & Groenen 1997, Modern Multidimensional Scaling."); m->mothurOutEndLine();
158                 m->mothurOut("The nmds command parameters are phylip, axes, mindim, maxdim, maxiters, iters and epsilon."); m->mothurOutEndLine();
159                 m->mothurOut("The phylip parameter allows you to enter your distance file."); m->mothurOutEndLine();
160                 m->mothurOut("The axes parameter allows you to enter a file containing a starting configuration."); m->mothurOutEndLine();
161                 m->mothurOut("The maxdim parameter allows you to select the maximum dimensions to use. Default=2"); m->mothurOutEndLine();
162                 m->mothurOut("The mindim parameter allows you to select the minimum dimensions to use. Default=2"); m->mothurOutEndLine();
163                 m->mothurOut("The maxiters parameter allows you to select the maximum number of iters to try with each random configuration. Default=500"); m->mothurOutEndLine();
164                 m->mothurOut("The iters parameter allows you to select the number of random configuration to try. Default=10"); m->mothurOutEndLine();
165                 m->mothurOut("The epsilon parameter allows you to select set an acceptable stopping point. Default=1e-12."); m->mothurOutEndLine();
166                 m->mothurOut("Example nmds(phylip=yourDistanceFile).\n");
167                 m->mothurOut("Note: No spaces between parameter labels (i.e. phylip), '=' and parameters (i.e.yourDistanceFile).\n\n");
168         }
169         catch(exception& e) {
170                 m->errorOut(e, "NMDSCommand", "help");
171                 exit(1);
172         }
173 }
174 //**********************************************************************************************************************
175 NMDSCommand::~NMDSCommand(){}
176 //**********************************************************************************************************************
177 int NMDSCommand::execute(){
178         try {
179                 
180                 if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
181                 
182                 cout.setf(ios::fixed, ios::floatfield);
183                 cout.setf(ios::showpoint);
184                 
185                 vector<string> names;
186                 vector< vector< double> > matrix; 
187                 
188                 //read in phylip file
189                 ReadPhylipVector readFile(phylipfile);
190                 names = readFile.read(matrix);
191                 if (m->control_pressed) { return 0; }
192                 
193                 //read axes
194                 vector< vector<double> > axes;
195                 if (axesfile != "") {  axes = readAxes(names);          }
196                 
197                 string outputFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.iters";
198                 string stressFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.stress";
199                 outputNames.push_back(outputFileName); outputTypes["iters"].push_back(outputFileName);
200                 outputNames.push_back(stressFileName); outputTypes["stress"].push_back(stressFileName);
201                 
202                 ofstream out, out2;
203                 m->openOutputFile(outputFileName, out);
204                 m->openOutputFile(stressFileName, out2);
205                 
206                 out2.setf(ios::fixed, ios::floatfield);
207                 out2.setf(ios::showpoint);
208                 out.setf(ios::fixed, ios::floatfield);
209                 out.setf(ios::showpoint);
210                 
211                 out2 << "Dimension\tIter\tStress\tRsq" << endl;
212                 
213                 double bestStress = 10000000;
214                 double bestR2 = 10000000;
215                 vector< vector<double> > bestConfig;
216                 int bestDim = 0;
217                 
218                 for (int i = mindim; i <= maxdim; i++) {
219                         m->mothurOut("Processing Dimension: " + toString(i)); m->mothurOutEndLine();
220                         
221                         for (int j = 0; j < iters; j++) {
222                                 m->mothurOut(toString(j+1)); m->mothurOutEndLine(); 
223                                 
224                                 //get configuration - either randomly generate or resize to this dimension
225                                 vector< vector<double> > thisConfig;
226                                 if (axesfile == "") {   thisConfig = generateStartingConfiguration(names.size(), i);            }
227                                 else                            {       thisConfig = getConfiguration(axes, i);                                                         }
228                                 if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
229                                 
230                                 //calc nmds for this dimension
231                                 double stress;
232                                 vector< vector<double> > endConfig = nmdsCalc(matrix, thisConfig, stress);
233                                 if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
234                                 
235                                 //calc euclid distances for new config
236                                 vector< vector<double> > newEuclid = linearCalc.calculateEuclidianDistance(endConfig);
237                                 if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
238                                 
239                                 //calc correlation between original distances and euclidean distances from this config
240                                 double rsquared = linearCalc.calcPearson(newEuclid, matrix);
241                                 rsquared *= rsquared;
242                                 if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
243                                 
244                                 //output results
245                                 out << "Config" << (j+1) << '\t';
246                                 for (int k = 0; k < i; k++) { out << "axis" << (k+1) << '\t'; }
247                                 out << endl;
248                                 out2 << i << '\t' << (j+1) << '\t' << stress << '\t' << rsquared << endl;
249                                 
250                                 output(endConfig, names, out);
251                                 
252                                 //save best
253                                 if (stress < bestStress) {
254                                         bestDim = i;
255                                         bestStress = stress;
256                                         bestR2 = rsquared;
257                                         bestConfig = endConfig;
258                                 }
259                                 
260                                 if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) {     remove(outputNames[k].c_str()); } return 0; }
261                         }
262                 }
263                 
264                 out.close(); out2.close();
265                 
266                 //output best config
267                 string BestFileName = outputDir + m->getRootName(m->getSimpleName(phylipfile)) + "nmds.axes";
268                 outputNames.push_back(BestFileName); outputTypes["nmds"].push_back(BestFileName);
269                 
270                 m->mothurOut("\nNumber of dimensions:\t" + toString(bestDim) + "\n");
271                 m->mothurOut("Lowest stress :\t" + toString(bestStress) + "\n");
272                 m->mothurOut("R-squared for configuration:\t" + toString(bestR2) + "\n");
273                 
274                 ofstream outBest;
275                 m->openOutputFile(BestFileName, outBest);
276                 outBest.setf(ios::fixed, ios::floatfield);
277                 outBest.setf(ios::showpoint);
278                 
279                 outBest << '\t';
280                 for (int k = 0; k < bestConfig.size(); k++) { outBest << "axis" << (k+1) << '\t'; }
281                 outBest << endl;
282                 
283                 output(bestConfig, names, outBest);
284                 
285                 outBest.close();
286                 
287                 if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
288                 
289                 m->mothurOutEndLine();
290                 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
291                 for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
292                 m->mothurOutEndLine();
293                 
294                 return 0;
295         }
296         catch(exception& e) {
297                 m->errorOut(e, "NMDSCommand", "execute");
298                 exit(1);
299         }
300 }
301 //**********************************************************************************************************************
302 vector< vector<double> > NMDSCommand::nmdsCalc(vector< vector<double> >& matrix, vector< vector<double> >& config, double& stress1) {
303         try {
304                 
305                 vector< vector<double> > newConfig = config;
306                 
307                 //calc euclid distances
308                 vector< vector<double> > euclid = linearCalc.calculateEuclidianDistance(newConfig);
309                 if (m->control_pressed) { return newConfig; }           
310                 
311                 double stress2 = calculateStress(matrix, euclid);
312                 stress1 = stress2 + 1.0 + epsilon;
313                 
314                 int count = 0;
315                 while ((count < maxIters) && (abs(stress1 - stress2) > epsilon)) {
316                         count++;
317                         
318                         stress1 = stress2;
319                         
320                         if (m->control_pressed) { return newConfig; }
321                         
322                         vector< vector<double> > b; b.resize(euclid.size());
323                         for (int i = 0; i < b.size(); i++) { b[i].resize(euclid[i].size(), 0.0); }
324                         
325                         vector<double> columnSums; columnSums.resize(euclid.size(), 0.0);
326                         for (int i = 0; i < euclid.size(); i++) {
327                                 for (int j = 0; j < euclid[i].size(); j++) {
328                                         //eliminate divide by zero error
329                                         if (euclid[i][j] != 0) { 
330                                                 b[i][j] = matrix[i][j] / euclid[i][j];
331                                                 columnSums[j] += b[i][j];
332                                                 b[i][j] *= -1.0;
333                                         }
334                                 }
335                         }
336                         
337                         //put in diagonal sums
338                         for (int i = 0; i < euclid.size(); i++) {  b[i][i] = columnSums[i]; }
339                         
340                         int numInLowerTriangle = matrix.size() * (matrix.size()-1) / 2.0;
341                         double n = (1.0 + sqrt(1.0 + 8.0 * numInLowerTriangle)) / 2.0;
342                         
343                         //matrix mult
344                         newConfig = linearCalc.matrix_mult(newConfig, b);
345                         for (int i = 0; i < newConfig.size(); i++) {
346                                 for (int j = 0; j < newConfig[i].size(); j++) {
347                                         newConfig[i][j] *= (1.0 / n);
348                                 }
349                         }
350                         
351                         euclid = linearCalc.calculateEuclidianDistance(newConfig);
352                         
353                         stress2 = calculateStress(matrix, euclid);
354                 }
355                 
356                 return newConfig;
357         }
358         catch(exception& e) {
359                 m->errorOut(e, "NMDSCommand", "generateStartingConfiguration");
360                 exit(1);
361         }
362 }
363
364 //**********************************************************************************************************************
365 //generate random config
366 vector< vector<double> > NMDSCommand::generateStartingConfiguration(int numNames, int dimension) {
367         try {
368                 vector< vector<double> > axes;  axes.resize(dimension);
369                 for (int i = 0; i < axes.size(); i++) {  axes[i].resize(numNames); }
370                 
371                 //generate random number between -1 and 1, precision 6
372                 for (int i = 0; i < axes.size(); i++) {
373                         for (int j = 0; j < axes[i].size(); j++) {
374                                 
375                                 if (m->control_pressed) { return axes; }
376                                 
377                                 //generate random int between 0 and 99999
378                                 int myrand = (int)((float)(rand()) / ((RAND_MAX / 99998) + 1));
379                                 
380                                 //generate random sign
381                                 int mysign = (int)((float)(rand()) / ((RAND_MAX / 99998) + 1));
382                                 
383                                 //if mysign is even then sign = positive, else sign = negative
384                                 if ((mysign % 2) == 0) { mysign = 1.0; }
385                                 else { mysign = -1.0; }
386                                 
387                                 axes[i][j] = mysign * myrand / (float) 100000;
388                         }
389                 }
390
391                 return axes;
392         }
393         catch(exception& e) {
394                 m->errorOut(e, "NMDSCommand", "generateStartingConfiguration");
395                 exit(1);
396         }
397 }
398 //**********************************************************************************************************************
399 //normalize configuration
400 int NMDSCommand::normalizeConfiguration(vector< vector<double> >& axes, int numNames, int dimension) {
401         try {
402                 vector<double> averageAxes; averageAxes.resize(dimension, 0.0);
403                 
404                 //find average
405                 for (int i = 0; i < axes.size(); i++) {
406                         for (int j = 0; j < axes[i].size(); j++) {      averageAxes[i] += axes[i][j];   }
407                         
408                         averageAxes[i] /= (float) numNames;
409                 }
410                 
411                 //normalize axes
412                 double sumDenom = 0.0;
413                 for (int i = 0; i < axes.size(); i++) {
414                         for (int j = 0; j < axes[i].size(); j++) {
415                                 sumDenom += ((axes[i][j] - averageAxes[i]) * (axes[i][j] - averageAxes[i]));
416                         }
417                 }
418                 
419                 double denom = sqrt((sumDenom / (float) (axes.size() * numNames)));
420                 
421                 for (int i = 0; i < axes.size(); i++) {
422                         for (int j = 0; j < axes[i].size(); j++) {
423                                 axes[i][j] = (axes[i][j] - averageAxes[i]) / denom;
424                         }
425                 }
426                 
427                 return 0;
428         }
429         catch(exception& e) {
430                 m->errorOut(e, "NMDSCommand", "normalizeConfiguration");
431                 exit(1);
432         }
433 }
434 //**********************************************************************************************************************
435 //get configuration
436 vector< vector<double> > NMDSCommand::getConfiguration(vector< vector<double> >& axes, int dimension) {
437         try {
438                 vector< vector<double> > newAxes; newAxes.resize(dimension);
439                 
440                 for (int i = 0; i < dimension; i++) {
441                         newAxes[i] = axes[i];
442                 }
443                                 
444                 return newAxes;
445         }
446         catch(exception& e) {
447                 m->errorOut(e, "NMDSCommand", "getConfiguration");
448                 exit(1);
449         }
450 }
451 //**********************************************************************************************************************
452 //find raw stress, and normalize using
453 double NMDSCommand::calculateStress(vector< vector<double> >& matrix, vector< vector<double> >& config) {
454         try {
455                 double normStress = 0.0;
456                 double denom = 0.0;
457                 double rawStress = 0.0;
458                 
459                 //find raw stress
460                 for (int i = 0; i < matrix.size(); i++) {
461                         for (int j = 0; j < matrix[i].size(); j++) {
462                                 if (m->control_pressed) { return normStress; }
463                                 
464                                 rawStress += ((matrix[i][j] - config[i][j]) * (matrix[i][j] - config[i][j]));
465                                 denom += (config[i][j] * config[i][j]);
466                         }
467                 }
468                 
469                 //normalize stress
470                 if ((rawStress != 0.0) && (denom != 0.0)) {
471                         normStress = sqrt((rawStress / denom));
472                 }
473
474                 return normStress;
475         }
476         catch(exception& e) {
477                 m->errorOut(e, "NMDSCommand", "calculateStress");
478                 exit(1);
479         }
480 }
481
482 //**********************************************************************************************************************
483 int NMDSCommand::output(vector< vector<double> >& config, vector<string>& names, ofstream& out) {
484         try {
485                 
486                 for (int i = 0; i < names.size(); i++) {
487                         
488                         out << names[i] << '\t';
489                         
490                         for (int j = 0; j < config.size(); j++) {
491                                 out << config[j][i] << '\t';
492                         }
493                         
494                         out << endl;
495                 }
496                 
497                 out << endl << endl;
498                         
499                 return 0;
500         }
501         catch(exception& e) {
502                 m->errorOut(e, "NMDSCommand", "output");
503                 exit(1);
504         }
505 }
506 /*****************************************************************/
507 vector< vector<double> > NMDSCommand::readAxes(vector<string> names){
508         try {
509                 ifstream in;
510                 m->openInputFile(axesfile, in);
511                 
512                 string headerLine = m->getline(in); m->gobble(in);
513                 
514                 //count the number of axis you are reading
515                 bool done = false;
516                 int count = 0;
517                 while (!done) {
518                         int pos = headerLine.find("axis");
519                         if (pos != string::npos) {
520                                 count++;
521                                 headerLine = headerLine.substr(pos+4);
522                         }else { done = true; }
523                 }
524                 
525                 if (maxdim > count) { 
526                         m->mothurOut("You requested maxdim = " + toString(maxdim) + ", but your file only includes " + toString(count) + ". Using " + toString(count) + "."); m->mothurOutEndLine(); 
527                         maxdim = count; 
528                         if (maxdim < mindim) { m->mothurOut("Also adjusting mindim to " + toString(maxdim-1) + "."); m->mothurOutEndLine(); }
529                 }
530                 
531                 vector< vector<double> > axes;  axes.resize(maxdim);
532                 for (int i = 0; i < axes.size(); i++) { axes[i].resize(names.size(), 0.0); }
533                 
534                 map <string, vector<double> > orderedAxes;
535                 map     <string, vector<double> >::iterator it;
536                 
537                 while (!in.eof()) {
538                         
539                         if (m->control_pressed) { in.close(); return axes; }
540                         
541                         string group = "";
542                         in >> group; m->gobble(in);
543                         
544                         bool ignore = false;
545                         if (!m->inUsersGroups(group, names)) { ignore = true; m->mothurOut(group + " is in your axes file and not in your distance file, ignoring."); m->mothurOutEndLine(); }
546                         
547                         vector<double> thisGroupsAxes;
548                         for (int i = 0; i < count; i++) {
549                                 float temp = 0.0;
550                                 in >> temp; 
551                                 
552                                 //only save the axis we want
553                                 if (i < maxdim) {  thisGroupsAxes.push_back(temp); }
554                         }
555                         
556                         if (!ignore) {  orderedAxes[group] = thisGroupsAxes; }
557                         
558                         m->gobble(in);
559                 }
560                 in.close();
561                                 
562                 //sanity check
563                 if (names.size() != orderedAxes.size()) { m->mothurOut("[ERROR]: your axes file does not match your distance file, aborting."); m->mothurOutEndLine(); m->control_pressed = true; return axes; }
564                 
565                 //put axes info in same order as distance file, just in case
566                 for (int i = 0; i < names.size(); i++) {
567                         it = orderedAxes.find(names[i]);
568                         
569                         if (it != orderedAxes.end()) {
570                                 vector<double> thisGroupsAxes = it->second;
571                                 
572                                 for (int j = 0; j < thisGroupsAxes.size(); j++) {
573                                         axes[j][i] = thisGroupsAxes[j];
574                                 }
575                                 
576                         }else { m->mothurOut("[ERROR]: your axes file does not match your distance file, aborting."); m->mothurOutEndLine(); m->control_pressed = true; return axes; }
577                 }
578                 
579                 return axes;
580         }
581         catch(exception& e) {
582                 m->errorOut(e, "NMDSCommand", "readAxes");      
583                 exit(1);
584         }
585 }
586 /**********************************************************************************************************************/
587
588
589