]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracunweightedcommand.cpp
working on current change
[mothur.git] / unifracunweightedcommand.cpp
index 81601a168a43875dcc20db786460bfa2cbc93faa..058555eeb26ef7608cd4a337e492cca135c3c55c 100644 (file)
@@ -80,11 +80,10 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(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 {
-                       //valid paramters for this command
-                       string Array[] =  {"groups","iters","distance","random","root", "processors","outputdir","inputdir"};
-                       vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+                       vector<string> myArray = setParameters();
                        
                        OptionParser parser(option);
                        map<string,string> parameters = parser.getParameters();
@@ -135,6 +134,10 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
                        }
                        
                        m->runParse = true;
+                       m->Groups.clear();
+                       m->namesOfGroups.clear();
+                       m->Treenames.clear();
+                       m->names.clear();
                        
                        //check for required parameters
                        treefile = validParameter.validFile(parameters, "tree", true);
@@ -143,16 +146,18 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
                                treefile = m->getTreeFile(); 
                                if (treefile != "") { m->mothurOut("Using " + treefile + " as input file for the tree parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current tree file and the tree parameter is required."); m->mothurOutEndLine(); abort = true; }                                                               
-                       }       
+                       }else { m->setTreeFile(treefile); }     
                        
                        //check for required parameters
                        groupfile = validParameter.validFile(parameters, "group", true);
                        if (groupfile == "not open") { abort = true; }
                        else if (groupfile == "not found") { groupfile = ""; }
+                       else { m->setGroupFile(groupfile); }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
                        if (namefile == "not open") { abort = true; }
                        else if (namefile == "not found") { namefile = ""; }
+                       else { m->setNameFile(namefile); }
                        
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = ""; }
                        
@@ -208,6 +213,8 @@ int UnifracUnweightedCommand::execute() {
                
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
+               m->setTreeFile(treefile);
+               
                if (groupfile != "") {
                        //read in group map info.
                        tmap = new TreeMap(groupfile);