]> git.donarmstrong.com Git - mothur.git/blobdiff - pcacommand.cpp
removed various build warnings
[mothur.git] / pcacommand.cpp
index c982d7563c8f26066924eeab070f5fd16a5b30e5..ee0a5462de87049f6b026546492203be630ea8d7 100644 (file)
 
 #include "pcacommand.h"
 
+//**********************************************************************************************************************
+vector<string> PCACommand::getValidParameters(){       
+       try {
+               string Array[] =  {"phylip", "outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "PCACommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+PCACommand::PCACommand(){      
+       try {
+               abort = true;
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["pcoa"] = tempOutNames;
+               outputTypes["loadings"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "PCACommand", "PCACommand");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> PCACommand::getRequiredParameters(){    
+       try {
+               string Array[] =  {"phylip"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "PCACommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> PCACommand::getRequiredFiles(){ 
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "PCACommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 
 PCACommand::PCACommand(string option)  {
@@ -47,7 +96,12 @@ PCACommand::PCACommand(string option)  {
                                        if (path == "") {       parameters["phylip"] = inputDir + it->second;           }
                                }
                        }
-
+                       
+                       //initialize outputTypes
+                       vector<string> tempOutNames;
+                       outputTypes["pcoa"] = tempOutNames;
+                       outputTypes["loadings"] = tempOutNames;
+                       
                        //required parameters
                        phylipfile = validParameter.validFile(parameters, "phylip", true);
                        if (phylipfile == "not open") { abort = true; }
@@ -512,15 +566,17 @@ void PCACommand::output(string fnameRoot, vector<string> name_list, vector<vecto
                        }
                }
                
-               ofstream pcaData((fnameRoot+"pca").c_str(), ios::trunc);
+               ofstream pcaData((fnameRoot+"pcoa").c_str(), ios::trunc);
                pcaData.setf(ios::fixed, ios::floatfield);
                pcaData.setf(ios::showpoint);   
-               outputNames.push_back(fnameRoot+"pca");
+               outputNames.push_back(fnameRoot+"pcoa");
+               outputTypes["pcoa"].push_back(fnameRoot+"pcoa");
                
-               ofstream pcaLoadings((fnameRoot+"pca.loadings").c_str(), ios::trunc);
+               ofstream pcaLoadings((fnameRoot+"pcoa.loadings").c_str(), ios::trunc);
                pcaLoadings.setf(ios::fixed, ios::floatfield);
                pcaLoadings.setf(ios::showpoint);
-               outputNames.push_back(fnameRoot+"pca.loadings");        
+               outputNames.push_back(fnameRoot+"pcoa.loadings");
+               outputTypes["loadings"].push_back(fnameRoot+"pcoa.loadings");   
                
                pcaLoadings << "axis\tloading\n";
                for(int i=0;i<rank;i++){