X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=clearcutcommand.cpp;h=c76de383fce839d31dd95e56bb7288a6df617d3c;hb=1d7a10dc3dafd1606d6255bdb54e02429cbee47c;hp=7d0d539eddeeae6e3ee6bfbe3e114c6b90e1bb7a;hpb=1b4aa03040e61f4c2d47ce32cb12726dcdadb917;p=mothur.git diff --git a/clearcutcommand.cpp b/clearcutcommand.cpp index 7d0d539..c76de38 100644 --- a/clearcutcommand.cpp +++ b/clearcutcommand.cpp @@ -137,7 +137,6 @@ void ClearcutCommand::help(){ try { m->mothurOut("The clearcut command interfaces mothur with the clearcut program written by Initiative for Bioinformatics and Evolutionary Studies (IBEST) at the University of Idaho.\n"); m->mothurOut("For more information about clearcut refer to http://bioinformatics.hungry.com/clearcut/ \n"); - m->mothurOut("The clearcut executable must be in a folder called clearcut in the same folder as your mothur executable, similar to mothur's requirements for using blast. \n"); m->mothurOut("The clearcut command parameters are phylip, fasta, version, verbose, quiet, seed, norandom, shuffle, neighbor, expblen, expdist, ntrees, matrixout, stdout, kimura, jukes, protein, DNA. \n"); m->mothurOut("The phylip parameter allows you to enter your phylip formatted distance matrix. \n"); m->mothurOut("The fasta parameter allows you to enter your aligned fasta file, if you enter a fastafile you specify if the sequences are DNA or protein using the DNA or protein parameters. \n"); @@ -175,13 +174,15 @@ int ClearcutCommand::execute() { try { if (abort == true) { return 0; } - + //prepare filename string outputName = outputDir + m->getRootName(m->getSimpleName(inputFile)) + "tre"; vector cPara; - char* tempClearcut = new char[8]; strcpy(tempClearcut, "clearcut"); cPara.push_back(tempClearcut); + char* tempClearcut = new char[8]; + strcpy(tempClearcut, "clearcut"); + cPara.push_back(tempClearcut); //you gave us a distance matrix if (phylipfile != "") { char* temp = new char[10]; strcpy(temp, "--distance"); cPara.push_back(temp); } @@ -202,25 +203,14 @@ int ClearcutCommand::execute() { if (shuffle) { char* temp = new char[9]; strcpy(temp, "--shuffle"); cPara.push_back(temp); } if (neighbor) { char* temp = new char[10]; strcpy(temp, "--neighbor"); cPara.push_back(temp); } - string tempIn = ""; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - tempIn += "--in=" + inputFile; - #else - tempIn += "--in=\"" + inputFile + "\""; - #endif - + string tempIn = "--in=" + inputFile; char* tempI = new char[tempIn.length()]; strcpy(tempI, tempIn.c_str()); cPara.push_back(tempI); if (stdoutWanted) { char* temp = new char[8]; strcpy(temp, "--stdout"); cPara.push_back(temp); } else{ - string tempOut = ""; - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - tempOut += "--out=" + outputName; - #else - tempOut += "--out=\"" + outputName + "\""; - #endif + string tempOut = "--out=" + outputName; char* temp = new char[tempOut.length()]; strcpy(temp, tempOut.c_str()); @@ -232,7 +222,7 @@ int ClearcutCommand::execute() { if (jukes) { char* temp = new char[7]; strcpy(temp, "--jukes"); cPara.push_back(temp); } if (kimura) { char* temp = new char[8]; strcpy(temp, "--kimura"); cPara.push_back(temp); } if (matrixout != "") { - string tempMatrix = "--matrixout=" + matrixout; + string tempMatrix = "--matrixout=" + outputDir + matrixout; char* temp = new char[tempMatrix.length()]; strcpy(temp, tempMatrix.c_str()); cPara.push_back(temp); @@ -255,11 +245,15 @@ int ClearcutCommand::execute() { clearcut_main(numArgs, clearcutParameters); + //free memory + for(int i = 0; i < cPara.size(); i++) { delete[] cPara[i]; } + delete[] clearcutParameters; + if (!stdoutWanted) { m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); m->mothurOut(outputName); m->mothurOutEndLine(); - if (matrixout != "") { m->mothurOut(matrixout); m->mothurOutEndLine(); } + if (matrixout != "") { m->mothurOut(outputDir+matrixout); m->mothurOutEndLine(); } m->mothurOutEndLine(); }