]> git.donarmstrong.com Git - mothur.git/blobdiff - phylotypecommand.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / phylotypecommand.cpp
index e7d12969a73a1a2d6576593fc36ec8eb5a9b1d2a..1d6c391de69c83a86971873577a0df0b21efdbcd 100644 (file)
@@ -45,7 +45,7 @@ string PhylotypeCommand::getHelpString(){
                helpString += "For the label parameter, levels count down from the root to keep the output similiar to mothur's other commands which report information from finer resolution to coarser resolutions.\n";
                helpString += "The phylotype command should be in the following format: \n";
                helpString += "phylotype(taxonomy=yourTaxonomyFile, cutoff=yourCutoff, label=yourLabels) \n";
-               helpString += "Eaxample: phylotype(taxonomy=amazon.taxonomy, cutoff=5, label=1-3-5).\n\n";
+               helpString += "Eaxample: phylotype(taxonomy=amazon.taxonomy, cutoff=5, label=1-3-5).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -76,6 +76,7 @@ PhylotypeCommand::PhylotypeCommand(string option)  {
                
                //allow user to run help
                if(option == "help") { help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
                        vector<string> myArray = setParameters();
@@ -127,12 +128,13 @@ PhylotypeCommand::PhylotypeCommand(string option)  {
                                        m->mothurOut("No valid current files. taxonomy is a required parameter."); m->mothurOutEndLine(); 
                                        abort = true; 
                                }
-                       }else if (taxonomyFileName == "not open") { abort = true; }     
+                       }else if (taxonomyFileName == "not open") { taxonomyFileName = ""; abort = true; }      
+                       else { m->setTaxonomyFile(taxonomyFileName); }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
-                       if (namefile == "not open") { abort = true; }
+                       if (namefile == "not open") { namefile = ""; abort = true; }
                        else if (namefile == "not found") { namefile = ""; }
-                       else { readNamesFile(); }       
+                       else { readNamesFile(); m->setNameFile(namefile); }     
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -142,7 +144,7 @@ PhylotypeCommand::PhylotypeCommand(string option)  {
                        
                        string temp = validParameter.validFile(parameters, "cutoff", false);
                        if (temp == "not found") { temp = "-1"; }
-                       convert(temp, cutoff); 
+                       m->mothurConvert(temp, cutoff); 
                        
                        label = validParameter.validFile(parameters, "label", false);                   
                        if (label == "not found") { label = ""; allLines = 1; }
@@ -151,6 +153,11 @@ PhylotypeCommand::PhylotypeCommand(string option)  {
                                else { allLines = 1;  }
                        }
                        
+                       if (namefile == "") {
+                               vector<string> files; files.push_back(taxonomyFileName);
+                               parser.getNameFile(files);
+                       }
+                       
                }
        }
        catch(exception& e) {
@@ -213,7 +220,7 @@ int PhylotypeCommand::execute(){
                        
                        if (m->control_pressed) { 
                                outRabund.close(); outSabund.close(); outList.close();
-                               for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
+                               for (int i = 0; i < outputNames.size(); i++) {  m->mothurRemove(outputNames[i]);  }
                                delete tree; return 0; 
                        }
                        
@@ -284,7 +291,7 @@ int PhylotypeCommand::execute(){
                delete tree;
                
                if (m->control_pressed) { 
-                       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurRemove(outputNames[i]);  }
                        return 0; 
                }