X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=shhhercommand.cpp;h=c405e38060cec0db4b610c2e6c9e24a8810d7aed;hp=9bd437ad3cb7b2a75b69770769c8ddbc942f4a35;hb=d1c97b8c04bb75faca1e76ffad60b37a4d789d3d;hpb=ac663461b19ad1436a06aa63f97221d1ff105482 diff --git a/shhhercommand.cpp b/shhhercommand.cpp index 9bd437a..c405e38 100644 --- a/shhhercommand.cpp +++ b/shhhercommand.cpp @@ -266,7 +266,17 @@ ShhherCommand::ShhherCommand(string option) { string temp; temp = validParameter.validFile(parameters, "lookup", true); if (temp == "not found") { - lookupFileName = "LookUp_Titanium.pat"; + string path = m->argv; + string tempPath = path; + for (int i = 0; i < path.length(); i++) { tempPath[i] = tolower(path[i]); } + path = path.substr(0, (tempPath.find_last_of('m'))); + +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) + path += "lookupFiles/"; +#else + path += "lookupFiles\\"; +#endif + lookupFileName = m->getFullPathName(path) + "LookUp_Titanium.pat"; int ableToOpen; ifstream in; @@ -276,7 +286,7 @@ ShhherCommand::ShhherCommand(string option) { //if you can't open it, try input location if (ableToOpen == 1) { if (inputDir != "") { //default path is set - string tryPath = inputDir + lookupFileName; + string tryPath = inputDir + m->getSimpleName(lookupFileName); m->mothurOut("Unable to open " + lookupFileName + ". Trying input directory " + tryPath); m->mothurOutEndLine(); ifstream in2; ableToOpen = m->openInputFile(tryPath, in2, "noerror"); @@ -324,7 +334,7 @@ ShhherCommand::ShhherCommand(string option) { for (int i = 0; i < exepath.length(); i++) { tempPath[i] = tolower(exepath[i]); } exepath = exepath.substr(0, (tempPath.find_last_of('m'))); - string tryPath = m->getFullPathName(exepath) + lookupFileName; + string tryPath = m->getFullPathName(exepath) + m->getSimpleName(lookupFileName); m->mothurOut("Unable to open " + lookupFileName + ". Trying mothur's executable location " + tryPath); m->mothurOutEndLine(); ifstream in2; int ableToOpen = m->openInputFile(tryPath, in2, "noerror"); @@ -1680,10 +1690,8 @@ void ShhherCommand::writeQualities(vector otuCounts){ if (m->control_pressed) { break; } int index = 0; - int base = 0; if(nSeqsPerOTU[i] > 0){ - qualities[i].assign(1024, -1); while(index < numFlowCells){ double maxPrValue = 1e8; @@ -1732,8 +1740,7 @@ void ShhherCommand::writeQualities(vector otuCounts){ value = (int)floor(temp); if(value > 100){ value = 100; } - qualities[i][base] = (int)value; - base++; + qualities[i].push_back((int)value); } } @@ -1744,12 +1751,7 @@ void ShhherCommand::writeQualities(vector otuCounts){ if(otuCounts[i] > 0){ qualityFile << '>' << seqNameVector[mapUniqueToSeq[i]] << endl; - - int j=4; //need to get past the first four bases - while(qualities[i][j] != -1){ - qualityFile << qualities[i][j] << ' '; - j++; - } + for (int j = 4; j < qualities[i].size(); j++) { qualityFile << qualities[i][j] << ' '; } qualityFile << endl; } } @@ -2384,16 +2386,22 @@ int ShhherCommand::driver(vector filenames, string thisCompositeFASTAFil m->mothurOut("\nFinalizing...\n"); fill(numOTUs, seqNumber, seqIndex, cumNumSeqs, nSeqsPerOTU, aaP, aaI); + if (m->debug) { m->mothurOut("[DEBUG]: done fill().\n"); } + if (m->control_pressed) { break; } setOTUs(numOTUs, numSeqs, seqNumber, seqIndex, cumNumSeqs, nSeqsPerOTU, otuData, singleTau, dist, aaP, aaI); + if (m->debug) { m->mothurOut("[DEBUG]: done setOTUs().\n"); } + if (m->control_pressed) { break; } vector otuCounts(numOTUs, 0); for(int j=0;jdebug) { m->mothurOut("[DEBUG]: done calcCentroidsDriver().\n"); } if (m->control_pressed) { break; } @@ -2727,7 +2735,8 @@ int ShhherCommand::cluster(string filename, string distFileName, string namesFil RAbundVector* rabund = new RAbundVector(list->getRAbundVector()); - Cluster* cluster = new CompleteLinkage(rabund, list, matrix, cutoff, "furthest"); + float adjust = -1.0; + Cluster* cluster = new CompleteLinkage(rabund, list, matrix, cutoff, "furthest", adjust); string tag = cluster->getTag(); double clusterCutoff = cutoff; @@ -3269,12 +3278,11 @@ void ShhherCommand::writeQualities(int numOTUs, int numFlowCells, string quality if (m->control_pressed) { break; } int index = 0; - int base = 0; - + if(nSeqsPerOTU[i] > 0){ - qualities[i].assign(1024, -1); while(index < numFlowCells){ + double maxPrValue = 1e8; short maxPrIndex = -1; double count = 0.0000; @@ -3293,7 +3301,7 @@ void ShhherCommand::writeQualities(int numOTUs, int numFlowCells, string quality pr[s] += tauValue * singleLookUp[s * NUMBINS + intensity]; } } - + maxPrIndex = uniqueFlowgrams[centroids[i] * numFlowCells + index]; maxPrValue = pr[maxPrIndex]; @@ -3304,7 +3312,7 @@ void ShhherCommand::writeQualities(int numOTUs, int numFlowCells, string quality for(int s=0;s 100){ value = 100; } - qualities[i][base] = (int)value; - base++; + qualities[i].push_back((int)value); } - } + }//end if index++; - } - } - + + }//end while + + }//end if + if(otuCounts[i] > 0){ qualityFile << '>' << seqNameVector[mapUniqueToSeq[i]] << endl; - - int j=4; //need to get past the first four bases - while(qualities[i][j] != -1){ - qualityFile << qualities[i][j] << ' '; - if (j > qualities[i].size()) { break; } - j++; - } + //need to get past the first four bases + for (int j = 4; j < qualities[i].size(); j++) { qualityFile << qualities[i][j] << ' '; } qualityFile << endl; } - } + }//end for qualityFile.close(); outputNames.push_back(qualityFileName); outputTypes["qfile"].push_back(qualityFileName);