From 4e4d3cb3315fe25b40383c6f65cd6be23f58903d Mon Sep 17 00:00:00 2001 From: westcott Date: Tue, 19 Jul 2011 16:09:58 +0000 Subject: [PATCH] added blastlocation to chimera.slayer and fixed issue with clearcut getting current file --- alignmentdb.cpp | 4 +- blastdb.cpp | 105 +++++++++++++++++++++------------------ blastdb.hpp | 4 +- chimeraslayer.cpp | 10 ++-- chimeraslayer.h | 6 +-- chimeraslayercommand.cpp | 45 +++++++++++++++-- chimeraslayercommand.h | 2 +- classify.cpp | 4 +- clearcutcommand.cpp | 4 +- 9 files changed, 118 insertions(+), 66 deletions(-) diff --git a/alignmentdb.cpp b/alignmentdb.cpp index 0fd2ac4..7c2916c 100644 --- a/alignmentdb.cpp +++ b/alignmentdb.cpp @@ -157,7 +157,7 @@ AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gap #endif } else if(method == "suffix") { search = new SuffixDB(numSeqs); } - else if(method == "blast") { search = new BlastDB(fastaFileName.substr(0,fastaFileName.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch); } + else if(method == "blast") { search = new BlastDB(fastaFileName.substr(0,fastaFileName.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch, ""); } else { m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8."); m->mothurOutEndLine(); @@ -198,7 +198,7 @@ AlignmentDB::AlignmentDB(string s){ method = s; if(method == "suffix") { search = new SuffixDB(); } - else if(method == "blast") { search = new BlastDB(); } + else if(method == "blast") { search = new BlastDB(""); } else { search = new KmerDB(); } diff --git a/blastdb.cpp b/blastdb.cpp index 96770dc..af15720 100644 --- a/blastdb.cpp +++ b/blastdb.cpp @@ -14,10 +14,11 @@ /**************************************************************************************************/ -BlastDB::BlastDB(string tag, float gO, float gE, float mm, float mM) : Database(), +BlastDB::BlastDB(string tag, float gO, float gE, float mm, float mM, string b) : Database(), gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) { try { count = 0; + path = b; int randNumber = rand(); //int randNumber = 12345; @@ -31,31 +32,38 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) { blastFileName = tag + pid + toString(randNumber) + ".blast"; //make sure blast exists in the write place - 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 (path == "") { + 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) + path += "blast/bin/"; +#else + path += "blast\\bin\\"; +#endif + } + string formatdbCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - formatdbCommand = path + "blast/bin/formatdb"; // format the database, -o option gives us the ability + formatdbCommand = path + "formatdb"; // format the database, -o option gives us the ability #else - formatdbCommand = path + "blast\\bin\\formatdb.exe"; - //wrap entire string in "" - //formatdbCommand = "\"" + formatdbCommand + "\""; + formatdbCommand = path + "formatdb.exe"; #endif //test to make sure formatdb exists ifstream in; formatdbCommand = m->getFullPathName(formatdbCommand); int ableToOpen = m->openInputFile(formatdbCommand, in, "no error"); in.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe."); m->mothurOutEndLine(); m->control_pressed = true; } string blastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - blastCommand = path + "blast/bin/blastall"; // format the database, -o option gives us the ability + blastCommand = path + "blastall"; // format the database, -o option gives us the ability #else - blastCommand = path + "blast\\bin\\blastall.exe"; + blastCommand = path + "blastall.exe"; //wrap entire string in "" //blastCommand = "\"" + blastCommand + "\""; #endif @@ -64,23 +72,21 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) { ifstream in2; blastCommand = m->getFullPathName(blastCommand); ableToOpen = m->openInputFile(blastCommand, in2, "no error"); in2.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + blastCommand + " file does not exist. mothur requires blastall.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + blastCommand + " file does not exist. mothur requires blastall.exe."); m->mothurOutEndLine(); m->control_pressed = true; } string megablastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - megablastCommand = path + "blast/bin/megablast"; // format the database, -o option gives us the ability + megablastCommand = path + "megablast"; // format the database, -o option gives us the ability #else - megablastCommand = path + "blast\\bin\\megablast.exe"; - //wrap entire string in "" - //megablastCommand = "\"" + megablastCommand + "\""; + megablastCommand = path + "megablast.exe"; #endif //test to make sure formatdb exists ifstream in3; megablastCommand = m->getFullPathName(megablastCommand); ableToOpen = m->openInputFile(megablastCommand, in3, "no error"); in3.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + megablastCommand + " file does not exist. mothur requires megablast.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + megablastCommand + " file does not exist. mothur requires megablast.exe."); m->mothurOutEndLine(); m->control_pressed = true; } } catch(exception& e) { @@ -90,10 +96,26 @@ gapOpen(gO), gapExtend(gE), match(mm), misMatch(mM) { } /**************************************************************************************************/ -BlastDB::BlastDB() : Database() { +BlastDB::BlastDB(string b) : Database() { try { count = 0; - + + path = b; + + //make sure blast exists in the write place + if (path == "") { + 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) + path += "blast/bin/"; +#else + path += "blast\\bin\\"; +#endif + } + int randNumber = rand(); string pid = ""; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) @@ -104,17 +126,11 @@ BlastDB::BlastDB() : Database() { queryFileName = pid + toString(randNumber) + ".candidate.unaligned.fasta"; blastFileName = pid + toString(randNumber) + ".blast"; - //make sure blast exists in the write place - 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'))); - string formatdbCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - formatdbCommand = path + "blast/bin/formatdb"; // format the database, -o option gives us the ability + formatdbCommand = path + "formatdb"; // format the database, -o option gives us the ability #else - formatdbCommand = path + "blast\\bin\\formatdb.exe"; + formatdbCommand = path + "formatdb.exe"; //wrap entire string in "" //formatdbCommand = "\"" + formatdbCommand + "\""; #endif @@ -123,13 +139,13 @@ BlastDB::BlastDB() : Database() { ifstream in; formatdbCommand = m->getFullPathName(formatdbCommand); int ableToOpen = m->openInputFile(formatdbCommand, in, "no error"); in.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe."); m->mothurOutEndLine(); m->control_pressed = true; } string blastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - blastCommand = path + "blast/bin/blastall"; // format the database, -o option gives us the ability + blastCommand = path + "blastall"; // format the database, -o option gives us the ability #else - blastCommand = path + "blast\\bin\\blastall.exe"; + blastCommand = path + "blastall.exe"; //wrap entire string in "" //blastCommand = "\"" + blastCommand + "\""; #endif @@ -138,14 +154,14 @@ BlastDB::BlastDB() : Database() { ifstream in2; blastCommand = m->getFullPathName(blastCommand); ableToOpen = m->openInputFile(blastCommand, in2, "no error"); in2.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + blastCommand + " file does not exist. mothur requires blastall.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + blastCommand + " file does not exist. mothur requires blastall.exe."); m->mothurOutEndLine(); m->control_pressed = true; } string megablastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - megablastCommand = path + "blast/bin/megablast"; // format the database, -o option gives us the ability + megablastCommand = path + "megablast"; // format the database, -o option gives us the ability #else - megablastCommand = path + "blast\\bin\\megablast.exe"; + megablastCommand = path + "megablast.exe"; //wrap entire string in "" //megablastCommand = "\"" + megablastCommand + "\""; #endif @@ -154,7 +170,7 @@ BlastDB::BlastDB() : Database() { ifstream in3; megablastCommand = m->getFullPathName(megablastCommand); ableToOpen = m->openInputFile(megablastCommand, in3, "no error"); in3.close(); - if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + megablastCommand + " file does not exist. mothur requires megablast.exe to be in the ./blast/bin folder relative to the mothur.exe location."); m->mothurOutEndLine(); m->control_pressed = true; } + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + megablastCommand + " file does not exist. mothur requires megablast.exe."); m->mothurOutEndLine(); m->control_pressed = true; } } @@ -208,10 +224,10 @@ vector BlastDB::findClosestSequences(Sequence* seq, int n) { string blastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - blastCommand = path + "blast/bin/blastall -p blastn -d " + dbFileName + " -m 8 -W 28 -v " + toString(n) + " -b " + toString(n); + blastCommand = path + "blastall -p blastn -d " + dbFileName + " -m 8 -W 28 -v " + toString(n) + " -b " + toString(n); blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber)); #else - blastCommand = "\"" + path + "blast\\bin\\blastall\" -p blastn -d " + "\"" + dbFileName + "\"" + " -m 8 -W 28 -v " + toString(n) + " -b " + toString(n); + blastCommand = "\"" + path + "blastall\" -p blastn -d " + "\"" + dbFileName + "\"" + " -m 8 -W 28 -v " + toString(n) + " -b " + toString(n); blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber)); //wrap entire string in "" blastCommand = "\"" + blastCommand + "\""; @@ -273,13 +289,13 @@ vector BlastDB::findClosestMegaBlast(Sequence* seq, int n, int minPerID) { //7000004128189528left 0 100 66 0 0 1 66 61 126 1e-31 131 string blastCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - blastCommand = path + "blast/bin/megablast -e 1e-10 -d " + dbFileName + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn + blastCommand = path + "megablast -e 1e-10 -d " + dbFileName + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber)); #else //blastCommand = path + "blast\\bin\\megablast -e 1e-10 -d " + dbFileName + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn //blastCommand += (" -i " + (queryFileName+toString(randNumber)) + " -o " + blastFileName+toString(randNumber)); - blastCommand = "\"" + path + "blast\\bin\\megablast\" -e 1e-10 -d " + "\"" + dbFileName + "\"" + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn + blastCommand = "\"" + path + "megablast\" -e 1e-10 -d " + "\"" + dbFileName + "\"" + " -m 8 -b " + toString(n) + " -v " + toString(n); //-W 28 -p blastn blastCommand += (" -i " + (queryFileName+pid+toString(randNumber)) + " -o " + blastFileName+pid+toString(randNumber)); //wrap entire string in "" blastCommand = "\"" + blastCommand + "\""; @@ -343,20 +359,15 @@ void BlastDB::generateDB() { try { //m->mothurOut("Generating the temporary BLAST database...\t"); cout.flush(); - - 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'))); - + string formatdbCommand; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - formatdbCommand = path + "blast/bin/formatdb -p F -o T -i " + dbFileName; // format the database, -o option gives us the ability + formatdbCommand = path + "formatdb -p F -o T -i " + dbFileName; // format the database, -o option gives us the ability #else //formatdbCommand = path + "blast\\bin\\formatdb -p F -o T -i " + dbFileName; // format the database, -o option gives us the ability - formatdbCommand = "\"" + path + "blast\\bin\\formatdb\" -p F -o T -i " + "\"" + dbFileName + "\""; + formatdbCommand = "\"" + path + "formatdb\" -p F -o T -i " + "\"" + dbFileName + "\""; //wrap entire string in "" formatdbCommand = "\"" + formatdbCommand + "\""; #endif diff --git a/blastdb.hpp b/blastdb.hpp index 5daedf5..99a9987 100644 --- a/blastdb.hpp +++ b/blastdb.hpp @@ -16,8 +16,8 @@ class BlastDB : public Database { public: - BlastDB(string, float, float, float, float); - BlastDB(); + BlastDB(string, float, float, float, float, string); + BlastDB(string); ~BlastDB(); void generateDB(); diff --git a/chimeraslayer.cpp b/chimeraslayer.cpp index 57528b4..9da0d3c 100644 --- a/chimeraslayer.cpp +++ b/chimeraslayer.cpp @@ -14,7 +14,7 @@ //*************************************************************************************************************** ChimeraSlayer::ChimeraSlayer(string file, string temp, bool trim, string mode, int k, int ms, int mms, int win, float div, -int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int numw, bool r) : Chimera() { +int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int numw, bool r, string blas) : Chimera() { try { fastafile = file; templateFileName = temp; templateSeqs = readSeqs(temp); @@ -35,6 +35,7 @@ int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int num realign = r; trimChimera = trim; numNoParents = 0; + blastlocation = blas; doPrep(); } @@ -46,7 +47,7 @@ int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int num //*************************************************************************************************************** //template=self ChimeraSlayer::ChimeraSlayer(string file, string temp, bool trim, map& prior, string mode, int k, int ms, int mms, int win, float div, - int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int numw, bool r) : Chimera() { + int minsim, int mincov, int minbs, int minsnp, int par, int it, int inc, int numw, bool r, string blas) : Chimera() { try { fastafile = file; templateSeqs = readSeqs(fastafile); templateFileName = temp; @@ -68,6 +69,7 @@ ChimeraSlayer::ChimeraSlayer(string file, string temp, bool trim, mapgetRootName(m->getSimpleName(fastafile)), -1.0, -1.0, 1, -3); + databaseLeft = new BlastDB(m->getRootName(m->getSimpleName(fastafile)), -1.0, -1.0, 1, -3, blastlocation); if (m->control_pressed) { return 0; } @@ -330,7 +332,7 @@ vector ChimeraSlayer::getTemplate(Sequence q, vector& user }else if (searchMethod == "blast") { //generate blastdb - databaseLeft = new BlastDB(m->getRootName(m->getSimpleName(templateFileName)), -1.0, -1.0, 1, -3); + databaseLeft = new BlastDB(m->getRootName(m->getSimpleName(templateFileName)), -1.0, -1.0, 1, -3, blastlocation); if (m->control_pressed) { return userTemplate; } diff --git a/chimeraslayer.h b/chimeraslayer.h index 8c3cbb2..ef7b3c3 100644 --- a/chimeraslayer.h +++ b/chimeraslayer.h @@ -24,8 +24,8 @@ class ChimeraSlayer : public Chimera { public: - ChimeraSlayer(string, string, bool, string, int, int, int, int, float, int, int, int, int, int, int, int, int, bool); - ChimeraSlayer(string, string, bool, map&, string, int, int, int, int, float, int, int, int, int, int, int, int, int, bool); + ChimeraSlayer(string, string, bool, string, int, int, int, int, float, int, int, int, int, int, int, int, int, bool, string); + ChimeraSlayer(string, string, bool, map&, string, int, int, int, int, float, int, int, int, int, int, int, int, int, bool, string); ~ChimeraSlayer(); @@ -54,7 +54,7 @@ class ChimeraSlayer : public Chimera { vector chimeraResults; data_results printResults; - string chimeraFlags, searchMethod, fastafile; + string chimeraFlags, searchMethod, fastafile, blastlocation; bool realign, trimChimera; int window, numWanted, kmerSize, match, misMatch, minSim, minCov, minBS, minSNP, parents, iters, increment; float divR; diff --git a/chimeraslayercommand.cpp b/chimeraslayercommand.cpp index 4c37a85..7c35453 100644 --- a/chimeraslayercommand.cpp +++ b/chimeraslayercommand.cpp @@ -36,6 +36,7 @@ vector ChimeraSlayerCommand::setParameters(){ CommandParameter pdivergence("divergence", "Number", "", "1.007", "", "", "",false,false); parameters.push_back(pdivergence); CommandParameter pparents("parents", "Number", "", "3", "", "", "",false,false); parameters.push_back(pparents); CommandParameter pincrement("increment", "Number", "", "5", "", "", "",false,false); parameters.push_back(pincrement); + CommandParameter pblastlocation("blastlocation", "String", "", "", "", "", "",false,false); parameters.push_back(pblastlocation); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); CommandParameter psave("save", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(psave); @@ -55,7 +56,7 @@ string ChimeraSlayerCommand::getHelpString(){ string helpString = ""; helpString += "The chimera.slayer command reads a fastafile and referencefile and outputs potentially chimeric sequences.\n"; helpString += "This command was modeled after the chimeraSlayer written by the Broad Institute.\n"; - helpString += "The chimera.slayer command parameters are fasta, name, template, processors, trim, ksize, window, match, mismatch, divergence. minsim, mincov, minbs, minsnp, parents, search, iters, increment, numwanted, and realign.\n"; + helpString += "The chimera.slayer command parameters are fasta, name, template, processors, trim, ksize, window, match, mismatch, divergence. minsim, mincov, minbs, minsnp, parents, search, iters, increment, numwanted, blastlocation and realign.\n"; helpString += "The fasta parameter allows you to enter the fasta file containing your potentially chimeric sequences, and is required, unless you have a valid current fasta file. \n"; helpString += "The name parameter allows you to provide a name file, if you are using reference=self. \n"; helpString += "You may enter multiple fasta files by separating their names with dashes. ie. fasta=abrecovery.fasta-amazon.fasta \n"; @@ -81,6 +82,7 @@ string ChimeraSlayerCommand::getHelpString(){ helpString += "The minsnp parameter allows you to specify percent of SNPs to sample on each side of breakpoint for computing bootstrap support (default: 10) \n"; helpString += "The search parameter allows you to specify search method for finding the closest parent. Choices are blast, and kmer, default blast. \n"; helpString += "The realign parameter allows you to realign the query to the potential parents. Choices are true or false, default true. \n"; + helpString += "The blastlocation parameter allows you to specify the location of your blast executable. By default mothur will look in ./blast/bin relative to mothur's executable. \n"; helpString += "If the save parameter is set to true the reference sequences will be saved in memory, to clear them later you can use the clear.memory command. Default=f."; helpString += "The chimera.slayer command should be in the following format: \n"; helpString += "chimera.slayer(fasta=yourFastaFile, reference=yourTemplate, search=yourSearch) \n"; @@ -408,6 +410,43 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option) { temp = validParameter.validFile(parameters, "numwanted", false); if (temp == "not found") { temp = "15"; } convert(temp, numwanted); + + blastlocation = validParameter.validFile(parameters, "blastlocation", false); + if (blastlocation == "not found") { blastlocation = ""; } + else { + //add / to name if needed + string lastChar = blastlocation.substr(blastlocation.length()-1); +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + if (lastChar != "/") { blastlocation += "/"; } +#else + if (lastChar != "\\") { blastlocation += "\\"; } +#endif + blastlocation = m->getFullPathName(blastlocation); + string formatdbCommand = ""; +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + formatdbCommand = blastlocation + "formatdb"; +#else + formatdbCommand = blastlocation + "formatdb.exe"; +#endif + + //test to make sure formatdb exists + ifstream in; + formatdbCommand = m->getFullPathName(formatdbCommand); + int ableToOpen = m->openInputFile(formatdbCommand, in, "no error"); in.close(); + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + formatdbCommand + " file does not exist. mothur requires formatdb.exe to run chimera.slayer."); m->mothurOutEndLine(); abort = true; } + + string blastCommand = ""; +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + blastCommand = blastlocation + "megablast"; +#else + blastCommand = blastlocation + "megablast.exe"; +#endif + //test to make sure formatdb exists + ifstream in2; + blastCommand = m->getFullPathName(blastCommand); + ableToOpen = m->openInputFile(blastCommand, in2, "no error"); in2.close(); + if(ableToOpen == 1) { m->mothurOut("[ERROR]: " + blastCommand + " file does not exist. mothur requires blastall.exe to run chimera.slayer."); m->mothurOutEndLine(); abort = true; } + } if ((search != "blast") && (search != "kmer")) { m->mothurOut(search + " is not a valid search."); m->mothurOutEndLine(); abort = true; } @@ -432,7 +471,7 @@ int ChimeraSlayerCommand::execute(){ int start = time(NULL); if (templatefile != "self") { //you want to run slayer with a refernce template - chimera = new ChimeraSlayer(fastaFileNames[s], templatefile, trim, search, ksize, match, mismatch, window, divR, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted, realign); + chimera = new ChimeraSlayer(fastaFileNames[s], templatefile, trim, search, ksize, match, mismatch, window, divR, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted, realign, blastlocation); }else { if (processors != 1) { m->mothurOut("When using template=self, mothur can only use 1 processor, continuing."); m->mothurOutEndLine(); processors = 1; } string nameFile = ""; @@ -466,7 +505,7 @@ int ChimeraSlayerCommand::execute(){ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; } - chimera = new ChimeraSlayer(fastaFileNames[s], templatefile, trim, priority, search, ksize, match, mismatch, window, divR, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted, realign); + chimera = new ChimeraSlayer(fastaFileNames[s], templatefile, trim, priority, search, ksize, match, mismatch, window, divR, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted, realign, blastlocation); } if (outputDir == "") { outputDir = m->hasPath(fastaFileNames[s]); }//if user entered a file with a path then preserve it diff --git a/chimeraslayercommand.h b/chimeraslayercommand.h index cfa934a..1b17391 100644 --- a/chimeraslayercommand.h +++ b/chimeraslayercommand.h @@ -53,7 +53,7 @@ private: #endif bool abort, realign, trim, trimera, save; - string fastafile, templatefile, outputDir, search, namefile; + string fastafile, templatefile, outputDir, search, namefile, blastlocation; int processors, window, iters, increment, numwanted, ksize, match, mismatch, parents, minSimilarity, minCoverage, minBS, minSNP, numSeqs, templateSeqsLength; float divR; Chimera* chimera; diff --git a/classify.cpp b/classify.cpp index 7770999..1642f0b 100644 --- a/classify.cpp +++ b/classify.cpp @@ -47,7 +47,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me } } else if(method == "suffix") { database = new SuffixDB(numSeqs); } - else if(method == "blast") { database = new BlastDB(tempFile.substr(0,tempFile.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch); } + else if(method == "blast") { database = new BlastDB(tempFile.substr(0,tempFile.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch, ""); } else if(method == "distance") { database = new DistanceDB(); } else { m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8."); @@ -176,7 +176,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me } } else if(method == "suffix") { database = new SuffixDB(numSeqs); } - else if(method == "blast") { database = new BlastDB(tempFile.substr(0,tempFile.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch); } + else if(method == "blast") { database = new BlastDB(tempFile.substr(0,tempFile.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch, ""); } else if(method == "distance") { database = new DistanceDB(); } else { m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8."); diff --git a/clearcutcommand.cpp b/clearcutcommand.cpp index 29a5d72..d3c7fa4 100644 --- a/clearcutcommand.cpp +++ b/clearcutcommand.cpp @@ -166,10 +166,10 @@ ClearcutCommand::ClearcutCommand(string option) { //is there are current file available for either of these? //give priority to phylip, then fasta phylipfile = m->getPhylipFile(); - if (phylipfile != "") { m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); } + if (phylipfile != "") { inputFile = phylipfile; m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); } else { fastafile = m->getFastaFile(); - if (fastafile != "") { m->mothurOut("Using " + fastafile + " as input file for the fasta parameter."); m->mothurOutEndLine(); } + if (fastafile != "") { inputFile = fastafile; m->mothurOut("Using " + fastafile + " as input file for the fasta parameter."); m->mothurOutEndLine(); } else { m->mothurOut("No valid current files. You must provide a phylip or fasta file before you can use the clearcut command."); m->mothurOutEndLine(); abort = true; -- 2.39.2