]> git.donarmstrong.com Git - mothur.git/blobdiff - mergegroupscommand.cpp
indicator command
[mothur.git] / mergegroupscommand.cpp
index 74bf0dea86c84c093d7d84b9c807b92be74892c6..a01441ed7ad6db77aa26b1a147755cd7eaa354bc 100644 (file)
@@ -43,7 +43,7 @@ string MergeGroupsCommand::getHelpString(){
                helpString += "The merge.groups command should be in the following format: merge.groups(design=yourDesignFile, shared=yourSharedFile).\n";
                helpString += "Example merge.groups(design=temp.design, groups=A-B-C, shared=temp.shared).\n";
                helpString += "The default value for groups is all the groups in your sharedfile, and all labels in your inputfile will be used.\n";
-               helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n";
+               helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -73,6 +73,7 @@ MergeGroupsCommand::MergeGroupsCommand(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();
@@ -125,7 +126,7 @@ MergeGroupsCommand::MergeGroupsCommand(string option) {
                                designfile = m->getDesignFile(); 
                                if (designfile != "") { m->mothurOut("Using " + designfile + " as input file for the design parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current designfile and the design parameter is required."); m->mothurOutEndLine(); abort = true; }
-                       }       
+                       }else { m->setDesignFile(designfile); } 
                        
                        //make sure the user has already run the read.otu command
                        sharedfile = validParameter.validFile(parameters, "shared", true);
@@ -135,7 +136,7 @@ MergeGroupsCommand::MergeGroupsCommand(string option) {
                                sharedfile = m->getSharedFile(); 
                                if (sharedfile != "") { m->mothurOut("Using " + sharedfile + " as input file for the shared parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current sharedfile and the shared parameter is required."); m->mothurOutEndLine(); abort = true; }
-                       }       
+                       }else { m->setSharedFile(sharedfile); } 
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
@@ -191,6 +192,8 @@ int MergeGroupsCommand::execute(){
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
                                
                                m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                               
+                               if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                                process(lookup, out);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -204,6 +207,7 @@ int MergeGroupsCommand::execute(){
                                lookup = input.getSharedRAbundVectors(lastLabel);
                                m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                                
+                               if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                                process(lookup, out);
                                
                                processedLabels.insert(lookup[0]->getLabel());
@@ -245,6 +249,7 @@ int MergeGroupsCommand::execute(){
                        
                        m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
                        
+                       if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                        process(lookup, out);
                        
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }