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) {
//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();
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);
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...
groups = validParameter.validFile(parameters, "groups", false);
if (groups == "not found") { groups = "all"; }
m->splitAtDash(groups, Groups);
- m->Groups = Groups;
+ m->setGroups(Groups);
}
}
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { out.close(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->clearGroups(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
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());
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());
//prevent memory leak
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
- if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); m->clearGroups(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//get next line to process
lookup = input.getSharedRAbundVectors();
}
- if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); m->clearGroups(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
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]; }
out.close();
//reset groups parameter
- m->Groups.clear();
+ m->clearGroups();
delete designMap;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0;}
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0;}
//set shared file as new current sharedfile