X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=bootstrapsharedcommand.cpp;h=4f4488085a8754b731ca6c742ee43f7b0dc690c4;hp=1b682c78e3471fe7b4fef8528e8d74243374cd21;hb=315e38cf393c82be238da5b32574f225a020d25c;hpb=c99f3846e7a7b6f06ab46508baa5409204ad6290 diff --git a/bootstrapsharedcommand.cpp b/bootstrapsharedcommand.cpp index 1b682c7..4f44880 100644 --- a/bootstrapsharedcommand.cpp +++ b/bootstrapsharedcommand.cpp @@ -36,7 +36,7 @@ BootSharedCommand::BootSharedCommand(string option){ else { //valid paramters for this command - string Array[] = {"label","calc","groups","iters"}; + string Array[] = {"label","calc","groups","iters","outputdir","inputdir"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -49,6 +49,13 @@ BootSharedCommand::BootSharedCommand(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 = ""; + outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it + } + + //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 bootstrap.shared command."); mothurOutEndLine(); abort = true; } @@ -373,12 +380,11 @@ void BootSharedCommand::process(SharedOrderVector* order) { try{ EstOutput data; vector subset; - - + //open an ostream for each calc to print to for (int z = 0; z < treeCalculators.size(); z++) { //create a new filename - outputFile = getRootName(globaldata->inputFileName) + treeCalculators[z]->getName() + ".boot" + order->getLabel() + ".tre"; + outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + treeCalculators[z]->getName() + ".boot" + order->getLabel() + ".tre"; openOutputFile(outputFile, *(out[z])); } @@ -446,7 +452,7 @@ void BootSharedCommand::process(SharedOrderVector* order) { //set global data to calc trees globaldata->gTree = trees[k]; - string filename = getRootName(globaldata->inputFileName) + treeCalculators[k]->getName() + ".boot" + order->getLabel(); + string filename = getRootName(getSimpleName(globaldata->inputFileName)) + treeCalculators[k]->getName() + ".boot" + order->getLabel(); consensus = new ConcensusCommand(filename); consensus->execute(); delete consensus;