else {
//valid paramters for this command
- string Array[] = {"freq","label","calc","groups"};
+ string Array[] = {"freq","label","calc","groups","all","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
}
+ //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"){ outputDir = ""; }
+
+
//make sure the user has already run the read.otu command
if (globaldata->getSharedFile() == "") {
if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
string temp;
temp = validParameter.validFile(parameters, "freq", false); if (temp == "not found") { temp = "100"; }
convert(temp, freq);
+
+ temp = validParameter.validFile(parameters, "all", false); if (temp == "not found") { temp = "false"; }
+ all = isTrue(temp);
if (abort == false) {
-
- string fileNameRoot = getRootName(globaldata->inputFileName);
+
+ if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
+ string fileNameRoot = outputDir + getRootName(getSimpleName(globaldata->inputFileName));
format = globaldata->getFormat();
int i;
mothurOut("The default value for groups is all the groups in your groupfile.\n");
validCalculator->printCalc("shared", cout);
mothurOut("The label parameter is used to analyze specific labels in your input.\n");
+ mothurOut("The all parameter is used to specify if you want the estimate of all your groups together. This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
+ mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed. You must enter at least 2 valid groups.\n");
mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
//if the users entered no valid calculators don't execute command
if (cDisplays.size() == 0) { return 0; }
-
+ for(int i=0;i<cDisplays.size();i++){ cDisplays[i]->setAll(all); }
+
read = new ReadOTUFile(globaldata->inputFileName);
read->read(&*globaldata);
-
+
input = globaldata->ginput;
order = input->getSharedOrderVector();
string lastLabel = order->getLabel();
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = labels;
-
+
//set users groups
util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "collect");
util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex);