X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=normalizesharedcommand.cpp;h=37cfb5daa98b4eeb850b44d60e5e9d80fa268de5;hb=a4f05f09c250323132a4b9427f41a3ededaec634;hp=85265015a7e6ea4de35552bd7d27d7efdc688348;hpb=afeb767205e3e7efd11bb7a36a36ad79ad05a779;p=mothur.git diff --git a/normalizesharedcommand.cpp b/normalizesharedcommand.cpp index 8526501..37cfb5d 100644 --- a/normalizesharedcommand.cpp +++ b/normalizesharedcommand.cpp @@ -24,8 +24,7 @@ vector NormalizeSharedCommand::getValidParameters(){ //********************************************************************************************************************** NormalizeSharedCommand::NormalizeSharedCommand(){ try { - abort = true; - //initialize outputTypes + abort = true; calledHelp = true; vector tempOutNames; outputTypes["shared"] = tempOutNames; } @@ -62,12 +61,12 @@ vector NormalizeSharedCommand::getRequiredFiles(){ NormalizeSharedCommand::NormalizeSharedCommand(string option) { try { globaldata = GlobalData::getInstance(); - abort = false; + abort = false; calledHelp = false; allLines = 1; labels.clear(); //allow user to run help - if(option == "help") { help(); abort = true; } + if(option == "help") { help(); abort = true; calledHelp = true; } else { //valid paramters for this command @@ -185,7 +184,7 @@ NormalizeSharedCommand::~NormalizeSharedCommand(){} int NormalizeSharedCommand::execute(){ try { - if (abort == true) { return 0; } + if (abort == true) { if (calledHelp) { return 0; } return 2; } string outputFileName = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "norm.shared"; ofstream out; @@ -382,6 +381,13 @@ int NormalizeSharedCommand::execute(){ m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["shared"].push_back(outputFileName); m->mothurOutEndLine(); + //set shared file as new current sharedfile + string current = ""; + itTypes = outputTypes.find("shared"); + if (itTypes != outputTypes.end()) { + if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSharedFile(current); } + } + return 0; } catch(exception& e) { @@ -405,7 +411,7 @@ int NormalizeSharedCommand::normalize(vector& thisLookUp, o int abund = thisLookUp[i]->getAbundance(j); - float relabund = relabund = abund / (float) thisLookUp[i]->getNumSeqs(); + float relabund = abund / (float) thisLookUp[i]->getNumSeqs(); float newNorm = relabund * norm; //round to nearest int @@ -479,7 +485,7 @@ int NormalizeSharedCommand::normalize(vector& thisLook float abund = thisLookUp[i]->getAbundance(j); - float relabund = relabund = abund / (float) thisLookUp[i]->getNumSeqs(); + float relabund = abund / (float) thisLookUp[i]->getNumSeqs(); float newNorm = relabund * norm; thisLookUp[i]->set(j, newNorm, thisLookUp[i]->getGroup());