X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=chimerapintailcommand.cpp;h=c5c678e78a344eed06ea0308c0df6178e7f22a51;hb=078d7227da8dda9ae8620822fa32d51ec2706fc3;hp=062779335148afcc61fb1fd51236467776b9d19b;hpb=7f0cae4f4853cc3f12bc751ee06ea31c7c97496e;p=mothur.git diff --git a/chimerapintailcommand.cpp b/chimerapintailcommand.cpp index 0627793..c5c678e 100644 --- a/chimerapintailcommand.cpp +++ b/chimerapintailcommand.cpp @@ -69,6 +69,27 @@ string ChimeraPintailCommand::getHelpString(){ } } //********************************************************************************************************************** +string ChimeraPintailCommand::getOutputFileNameTag(string type, string inputName=""){ + try { + string outputFileName = ""; + map >::iterator it; + + //is this a type this command creates + it = outputTypes.find(type); + if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); } + else { + if (type == "chimera") { outputFileName = "pintail.chimeras"; } + else if (type == "accnos") { outputFileName = "pintail.accnos"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; } + } + return outputFileName; + } + catch(exception& e) { + m->errorOut(e, "ChimeraPintailCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** ChimeraPintailCommand::ChimeraPintailCommand(){ try { abort = true; calledHelp = true; @@ -225,13 +246,13 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option) { temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); } m->setProcessors(temp); - convert(temp, processors); + m->mothurConvert(temp, processors); temp = validParameter.validFile(parameters, "window", false); if (temp == "not found") { temp = "0"; } - convert(temp, window); + m->mothurConvert(temp, window); temp = validParameter.validFile(parameters, "increment", false); if (temp == "not found") { temp = "25"; } - convert(temp, increment); + m->mothurConvert(temp, increment); temp = validParameter.validFile(parameters, "save", false); if (temp == "not found"){ temp = "f"; } save = m->isTrue(temp); @@ -397,11 +418,11 @@ int ChimeraPintailCommand::execute(){ if (outputDir == "") { outputDir = m->hasPath(fastaFileNames[s]); }//if user entered a file with a path then preserve it string outputFileName, accnosFileName; if (maskfile != "") { - outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.chimeras"; - accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + ".pintail.accnos"; + outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + getOutputFileNameTag("chimera"); + accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + m->getSimpleName(m->getRootName(maskfile)) + getOutputFileNameTag("accnos"); }else { - outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "pintail.chimeras"; - accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "pintail.accnos"; + outputFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + getOutputFileNameTag("chimera"); + accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + getOutputFileNameTag("accnos"); } if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; } @@ -488,7 +509,7 @@ int ChimeraPintailCommand::execute(){ #else //break up file - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) vector positions = m->divideFile(fastaFileNames[s], processors); for (int i = 0; i < (positions.size()-1); i++) { @@ -611,7 +632,7 @@ int ChimeraPintailCommand::driver(linePair* filePos, string outputFName, string } delete candidateSeq; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) unsigned long long pos = inFASTA.tellg(); if ((pos == -1) || (pos >= filePos->end)) { break; } #else @@ -697,7 +718,7 @@ int ChimeraPintailCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fi int ChimeraPintailCommand::createProcesses(string outputFileName, string filename, string accnos) { try { -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) int process = 0; int num = 0;