]> git.donarmstrong.com Git - mothur.git/blobdiff - pcoacommand.cpp
some minor changes
[mothur.git] / pcoacommand.cpp
index 6777b5a56cb1182654c66bf6d065f9f973a10525..4be5ffb8c5b63c4202666aecd57ec58c2be05374 100644 (file)
@@ -26,8 +26,7 @@ vector<string> PCOACommand::getValidParameters(){
 //**********************************************************************************************************************
 PCOACommand::PCOACommand(){    
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["pcoa"] = tempOutNames;
                outputTypes["loadings"] = tempOutNames;
@@ -64,10 +63,10 @@ vector<string> PCOACommand::getRequiredFiles(){
 
 PCOACommand::PCOACommand(string option)  {
        try {
-               abort = false;
+               abort = false; calledHelp = false;   
                
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -149,7 +148,7 @@ PCOACommand::~PCOACommand(){}
 int PCOACommand::execute(){
        try {
        
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                cout.setf(ios::fixed, ios::floatfield);
                cout.setf(ios::showpoint);
@@ -198,7 +197,7 @@ int PCOACommand::execute(){
                                
                                double corr = linearCalc.calcPearson(EuclidDists, D); //G is the pcoa file, D is the users distance matrix
                                
-                               m->mothurOut("Pearson's coefficient using " + toString(i) + " axis: " + toString(corr)); m->mothurOutEndLine();
+                               m->mothurOut("Rsq " + toString(i) + " axis: " + toString(corr * corr)); m->mothurOutEndLine();
                                
                                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str());  } return 0; }
                        }
@@ -277,11 +276,11 @@ void PCOACommand::output(string fnameRoot, vector<string> name_list, vector<vect
                        }
                }
                
-               ofstream pcaData((fnameRoot+"pcoa").c_str(), ios::trunc);
+               ofstream pcaData((fnameRoot+"pcoa.axes").c_str(), ios::trunc);
                pcaData.setf(ios::fixed, ios::floatfield);
                pcaData.setf(ios::showpoint);   
-               outputNames.push_back(fnameRoot+"pcoa");
-               outputTypes["pcoa"].push_back(fnameRoot+"pcoa");
+               outputNames.push_back(fnameRoot+"pcoa.axes");
+               outputTypes["pcoa"].push_back(fnameRoot+"pcoa.axes");
                
                ofstream pcaLoadings((fnameRoot+"pcoa.loadings").c_str(), ios::trunc);
                pcaLoadings.setf(ios::fixed, ios::floatfield);