]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracweightedcommand.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / unifracweightedcommand.cpp
index a0d710e7b2ebbb7cffaf4aca88365a3ab73a197c..f9dc450444b242555710f91dc3567f96e69e6d3d 100644 (file)
@@ -141,7 +141,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        
                        //check for required parameters
                        treefile = validParameter.validFile(parameters, "tree", true);
-                       if (treefile == "not open") { abort = true; }
+                       if (treefile == "not open") { treefile = ""; abort = true; }
                        else if (treefile == "not found") {                             //if there is a current design file, use it
                                treefile = m->getTreeFile(); 
                                if (treefile != "") { m->mothurOut("Using " + treefile + " as input file for the tree parameter."); m->mothurOutEndLine(); }
@@ -155,7 +155,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        else { m->setGroupFile(groupfile); }
                        
                        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 { m->setNameFile(namefile); }
                        
@@ -172,7 +172,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        }
                                
                        itersString = validParameter.validFile(parameters, "iters", false);                     if (itersString == "not found") { itersString = "1000"; }
-                       convert(itersString, iters); 
+                       m->mothurConvert(itersString, iters); 
                        
                        string temp = validParameter.validFile(parameters, "distance", false);                  
                        if (temp == "not found") { phylip = false; outputForm = ""; }
@@ -189,9 +189,14 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        
                        temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = m->getProcessors();      }
                        m->setProcessors(temp);
-                       convert(temp, processors);
+                       m->mothurConvert(temp, processors);
                        
                        if (!random) {  iters = 0;  } //turn off random calcs
+                       
+                       if (namefile == "") {
+                               vector<string> files; files.push_back(treefile);
+                               parser.getNameFile(files);
+                       }
                }
                
                
@@ -277,10 +282,11 @@ int UnifracWeightedCommand::execute() {
                        
                util = new SharedUtil();
                string s; //to make work with setgroups
-               vector<string> Groups = m->getGroups();
+               Groups = m->getGroups();
                vector<string> nameGroups = tmap->getNamesOfGroups();
                util->setGroups(Groups, nameGroups, s, numGroups, "weighted");  //sets the groups the user wants to analyze
                util->getCombos(groupComb, Groups, numComp);
+               m->setGroups(Groups);
                delete util;
                
                weighted = new Weighted(tmap, includeRoot);