X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=collectsharedcommand.cpp;h=2f12282d7c4ca3379e9fe9b9848acd6ed5bd2df6;hb=6777912b79eb6d011163da47f3ada09d1a9293c1;hp=a772eb18354fcbd109f2bcf258fad1d445a7f5e6;hpb=7b3c9ca940891c1b20b3b7ec13e05d7e7b316b63;p=mothur.git diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index a772eb1..2f12282 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -50,7 +50,7 @@ CollectSharedCommand::CollectSharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"freq","label","calc","groups","all"}; + string Array[] = {"freq","label","calc","groups","all","outputdir","inputdir"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -63,6 +63,10 @@ CollectSharedCommand::CollectSharedCommand(string 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; } @@ -103,12 +107,13 @@ CollectSharedCommand::CollectSharedCommand(string option){ 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 = "true"; } + 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; @@ -184,7 +189,7 @@ void CollectSharedCommand::help(){ 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 true.\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"); @@ -218,10 +223,10 @@ int CollectSharedCommand::execute(){ //if the users entered no valid calculators don't execute command if (cDisplays.size() == 0) { return 0; } for(int i=0;isetAll(all); } - + read = new ReadOTUFile(globaldata->inputFileName); read->read(&*globaldata); - + input = globaldata->ginput; order = input->getSharedOrderVector(); string lastLabel = order->getLabel(); @@ -229,7 +234,7 @@ int CollectSharedCommand::execute(){ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label. set processedLabels; set userLabels = labels; - + //set users groups util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "collect"); util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex);