diff --git a/source/chimera/chimeracheckrdp.cpp b/source/chimera/chimeracheckrdp.cpp index 9e91a96b..72b4a79f 100644 --- a/source/chimera/chimeracheckrdp.cpp +++ b/source/chimera/chimeracheckrdp.cpp @@ -20,7 +20,7 @@ ChimeraCheckRDP::ChimeraCheckRDP(string filename, string temp, string n, bool s, kmerSize = k; outputDir = o; - templateDB = new AlignmentDB(templateFileName, "kmer", kmerSize, 0.0,0.0,0.0,0.0, rand()); + templateDB = new AlignmentDB(templateFileName, "kmer", kmerSize, 0.0,0.0,0.0,0.0, rand(), true); m->mothurOutEndLine(); kmer = new Kmer(kmerSize); diff --git a/source/commands/aligncommand.cpp b/source/commands/aligncommand.cpp index 33190ece..6e4f6dd8 100644 --- a/source/commands/aligncommand.cpp +++ b/source/commands/aligncommand.cpp @@ -295,7 +295,7 @@ int AlignCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } - templateDB = new AlignmentDB(templateFileName, search, kmerSize, gapOpen, gapExtend, match, misMatch, rand()); + templateDB = new AlignmentDB(templateFileName, search, kmerSize, gapOpen, gapExtend, match, misMatch, rand(), true); for (int s = 0; s < candidateFileNames.size(); s++) { if (m->control_pressed) { outputTypes.clear(); return 0; } diff --git a/source/commands/aligncommand.h b/source/commands/aligncommand.h index 7afe6c0c..01c40cef 100644 --- a/source/commands/aligncommand.h +++ b/source/commands/aligncommand.h @@ -135,7 +135,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); } - AlignmentDB* templateDB = new AlignmentDB(pDataArray->templateFileName, pDataArray->search, pDataArray->kmerSize, pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, pDataArray->threadID); + AlignmentDB* templateDB = new AlignmentDB(pDataArray->templateFileName, pDataArray->search, pDataArray->kmerSize, pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, pDataArray->threadID, false); //moved this into driver to avoid deep copies in windows paralellized version Alignment* alignment; diff --git a/source/commands/classifyseqscommand.cpp b/source/commands/classifyseqscommand.cpp index 1889d911..5a0025ac 100644 --- a/source/commands/classifyseqscommand.cpp +++ b/source/commands/classifyseqscommand.cpp @@ -908,7 +908,7 @@ int ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile, string extension = ""; if (i != 0) { extension = toString(i) + ".temp"; processIDS.push_back(i); } - classifyData* tempclass = new classifyData((accnos + extension), probs, method, templateFileName, taxonomyFileName, (taxFileName + extension), (tempTaxFile + extension), filename, search, kmerSize, iters, numWanted, m, lines[i]->start, lines[i]->end, match, misMatch, gapOpen, gapExtend, cutoff, i, flip, writeShortcuts); + classifyData* tempclass = new classifyData((accnos + extension), probs, method, templateFileName, taxonomyFileName, (taxFileName + extension), (tempTaxFile + extension), filename, search, kmerSize, iters, numWanted, m, lines[i]->start, lines[i]->end, match, misMatch, gapOpen, gapExtend, cutoff, i, flip, false); pDataArray.push_back(tempclass); //MySeqSumThreadFunction is in header. It must be global or static to work with the threads. diff --git a/source/commands/renamefilecommand.cpp b/source/commands/renamefilecommand.cpp index ec49cc68..18387fcc 100644 --- a/source/commands/renamefilecommand.cpp +++ b/source/commands/renamefilecommand.cpp @@ -463,13 +463,14 @@ RenameFileCommand::RenameFileCommand(string option) { temp = validParameter.validFile(parameters, "deleteold", false); if (temp == "not found") { temp = "T"; } deleteOld = m->isTrue(temp); - prefix = validParameter.validFile(parameters, "prefix", false); if (prefix == "not found") { temp = ""; } + prefix = validParameter.validFile(parameters, "prefix", false); if (prefix == "not found") { prefix = ""; } outputfile = validParameter.validFile(parameters, "new", false); if (outputfile == "not found") { if (!mothurGenerated) { m->mothurOut("[ERROR]: you must enter an output file name"); m->mothurOutEndLine(); abort=true; } outputfile = ""; - }else if (outputDir != "") { outputfile = outputDir + m->getSimpleName(outputfile); } + }else { mothurGenerated=false; } + if (outputDir != "") { outputfile = outputDir + m->getSimpleName(outputfile); } if ((!mothurGenerated) && (numFiles > 1)) { m->mothurOut("[ERROR]: You cannot use more than one file parameter unless mothur is generating the output filenames for you.\n"); abort= true; @@ -632,6 +633,7 @@ int RenameFileCommand::execute(){ string RenameFileCommand::getNewName(string name, string type){ try { string newName = outputfile; + name = m->getFullPathName(name); if (mothurGenerated) { string extension = m->getExtension(name); @@ -644,12 +646,15 @@ string RenameFileCommand::getNewName(string name, string type){ }else { basicName = prefix; } if ((type == "shared") || (type == "list") || (type == "relabund") || (type == "rabund") || (type == "sabund")) { - vector tags; tags.push_back(".an."); tags.push_back(".tx."); tags.push_back(".agc."); tags.push_back(".dgc."); tags.push_back(".nn."); tags.push_back(".fn."); tags.push_back(".wn."); tags.push_back(".opti."); - vector newTags; newTags.push_back("an"); newTags.push_back("tx"); newTags.push_back("agc"); newTags.push_back("dgc"); newTags.push_back("nn"); newTags.push_back("fn"); newTags.push_back("wn"); tags.push_back(".opti."); + vector tags; tags.push_back(".an."); tags.push_back(".tx."); tags.push_back(".agc."); tags.push_back(".dgc."); tags.push_back(".nn."); tags.push_back(".fn."); tags.push_back(".wn."); tags.push_back(".opti_"); for (int i = 0; i < tags.size(); i++) { - int pos2 = name.find_first_of(tags[i]); - if (pos2 != string::npos) { tag = newTags[i]; break; } + int pos2 = name.find(tags[i]); + if (pos2 != string::npos) { + int pos3 = name.substr(pos2+1).find_first_of('.'); + tag = name.substr(pos2+1, pos3); + break; + } } }else if (type == "constaxonomy") { extension = ".cons.taxonomy"; diff --git a/source/datastructures/alignmentdb.cpp b/source/datastructures/alignmentdb.cpp index ea65c8e6..cdc5e672 100644 --- a/source/datastructures/alignmentdb.cpp +++ b/source/datastructures/alignmentdb.cpp @@ -13,7 +13,7 @@ #include "blastdb.hpp" /**************************************************************************************************/ -AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int tid){ // This assumes that the template database is in fasta format, may +AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int tid, bool writeShortcut){ // This assumes that the template database is in fasta format, may try { // need to alter this in the future? m = MothurOut::getInstance(); longest = 0; @@ -104,8 +104,8 @@ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gap if (m->control_pressed) { templateSequences.clear(); } - search->generateDB(); - + if ((method != "kmer") || ((method == "kmer") && (writeShortcut))) { search->generateDB(); } + }else if ((method == "kmer") && (!needToGenerate)) { ifstream kmerFileTest(kmerDBName.c_str()); search->readKmerDB(kmerFileTest); diff --git a/source/datastructures/alignmentdb.h b/source/datastructures/alignmentdb.h index 537af8d2..0d66ddf9 100644 --- a/source/datastructures/alignmentdb.h +++ b/source/datastructures/alignmentdb.h @@ -20,7 +20,7 @@ class AlignmentDB { public: - AlignmentDB(string, string, int, float, float, float, float, int); //reads fastafile passed in and stores sequences + AlignmentDB(string, string, int, float, float, float, float, int, bool); //reads fastafile passed in and stores sequences AlignmentDB(string); ~AlignmentDB(); diff --git a/source/datastructures/kmerdb.cpp b/source/datastructures/kmerdb.cpp index 9a5d2350..df7d3e4e 100644 --- a/source/datastructures/kmerdb.cpp +++ b/source/datastructures/kmerdb.cpp @@ -123,7 +123,7 @@ vector KmerDB::findClosestSequences(Sequence* candidateSeq, int num){ } /**************************************************************************************************/ - +//print shortcut file void KmerDB::generateDB(){ try {