@@ -13,6 +13,7 @@
vector<string> SetDirectoryCommand::setParameters (){
try {
CommandParameter ptempdefault (" tempdefault" , " String" , " " , " " , " " , " " , " " ," " ,false ,false ); parameters.push_back (ptempdefault);
+ CommandParameter pblast (" blastdir" , " String" , " " , " " , " " , " " , " " ," " ,false ,false ); parameters.push_back (pblast);
CommandParameter pdebug (" debug" , " Boolean" , " " , " F" , " " , " " , " " ," " ,false ,false ); parameters.push_back (pdebug);
CommandParameter pseed (" seed" , " Number" , " " , " 0" , " " , " " , " " ," " ,false ,false ); parameters.push_back (pseed);
CommandParameter pmodnames (" modifynames" , " Boolean" , " " , " T" , " " , " " , " " ," " ,false ,false ); parameters.push_back (pmodnames);
@@ -37,6 +38,7 @@ string SetDirectoryCommand::getHelpString(){
helpString += " The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n " ;
helpString += " The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n " ;
helpString += " The set.dir command can also be used to override or set the default location mothur will look for files if it is unable to find them, the directory must exist.\n " ;
+ helpString += " The set.dir command can also be used to set the location of the blast directory if other than mothur's executable location, the directory must exist.\n " ;
helpString += " The set.dir command can also be used to run mothur in debug mode.\n " ;
helpString += " The set.dir command can also be used to seed random.\n " ;
helpString += " The set.dir command can also be used to set the modifynames parameter. Default=t, meaning if your sequence names contain ':' change them to '_' to avoid issues while making trees. modifynames=F will leave sequence names as they are.\n " ;
@@ -45,6 +47,7 @@ string SetDirectoryCommand::getHelpString(){
helpString += " To seed random set seed=yourRandomValue. By default mothur seeds random with the start time.\n " ;
helpString += " To return the output to the same directory as the input files you may enter: output=clear.\n " ;
helpString += " To return the input to the current working directory you may enter: input=clear.\n " ;
+ helpString += " To set the blast location to the directory where the blast executables are located you may enter: blastdir=yourBlastLocation.\n " ;
helpString += " To set the output to the directory where mothur.exe is located you may enter: output=default.\n " ;
helpString += " To set the input to the directory where mothur.exe is located you may enter: input=default.\n " ;
helpString += " To return the tempdefault to the default you provided at compile time you may enter: tempdefault=clear.\n " ;
@@ -90,6 +93,9 @@ SetDirectoryCommand::SetDirectoryCommand(string option) {
tempdefault = validParameter.validFile (parameters, " tempdefault" , false );
if (tempdefault == " not found" ) { tempdefault = " " ; }
+ blastLocation = validParameter.validFile (parameters, " blastdir" , false );
+ if (blastLocation == " not found" ) { blastLocation = " " ; }
+
bool debug = false ;
bool nodebug = false ;
debugorSeedOnly = false ;
@@ -118,9 +124,9 @@ SetDirectoryCommand::SetDirectoryCommand(string option) {
m->mothurOut (" Setting random seed to " + toString (random ) + " .\n\n " );
}
- if ((input == " " ) && (output == " " ) && (tempdefault == " " ) && nodebug && nomod && !seed) {
- m->mothurOut (" [ERROR]: You must provide either an input, output, tempdefault, debug or modifynames for the set.dir command." ); m->mothurOutEndLine (); abort = true ;
- }else if ((input == " " ) && (output == " " ) && (tempdefault == " " )) { debugorSeedOnly = true ; }
+ if ((input == " " ) && (output == " " ) && (tempdefault == " " ) && (blastLocation == " " ) && nodebug && nomod && !seed) {
+ m->mothurOut (" [ERROR]: You must provide either an input, output, tempdefault, blastdir, debug or modifynames for the set.dir command." ); m->mothurOutEndLine (); abort = true ;
+ }else if ((input == " " ) && (output == " " ) && (tempdefault == " " ) && (blastLocation == " " ) ) { debugorSeedOnly = true ; }
}
}
catch (exception& e) {
@@ -143,8 +149,8 @@ int SetDirectoryCommand::execute(){
// redirect output
if ((output == " clear" ) || (output == " " )) { output = " " ; commandFactory->setOutputDirectory (output); }
else if (output == " default" ) {
- string exepath = m->argv ;
- output = exepath.substr (0 , (exepath.find_last_of (' m' )));
+ string output = m->mothurProgramPath ;
+ // output = exepath.substr(0, (exepath.find_last_of('m')));
m->mothurOut (" outputDir=" + output); m->mothurOutEndLine ();
commandFactory->setOutputDirectory (output);
@@ -158,8 +164,8 @@ int SetDirectoryCommand::execute(){
// redirect input
if ((input == " clear" ) || (input == " " )) { input = " " ; commandFactory->setInputDirectory (input); }
else if (input == " default" ) {
- string exepath = m->argv ;
- input = exepath.substr (0 , (exepath.find_last_of (' m' )));
+ string input = m->mothurProgramPath ;
+ // input = exepath.substr(0, (exepath.find_last_of('m')));
m->mothurOut (" inputDir=" + input); m->mothurOutEndLine ();
commandFactory->setInputDirectory (input);
@@ -183,8 +189,8 @@ int SetDirectoryCommand::execute(){
#endif
}else if (tempdefault == " " ) { // do nothing
}else if (tempdefault == " default" ) {
- string exepath = m->argv ;
- tempdefault = exepath.substr (0 , (exepath.find_last_of (' m' )));
+ string tempdefault = m->mothurProgramPath ;
+ // tempdefault = exepath.substr(0, (exepath.find_last_of('m')));
m->mothurOut (" tempDefault=" + tempdefault); m->mothurOutEndLine ();
m->setDefaultPath (tempdefault);
@@ -194,6 +200,21 @@ int SetDirectoryCommand::execute(){
m->setDefaultPath (tempdefault);
}
}
+
+ // set default
+ if (blastLocation == " " ) { // do nothing }
+ }else if ((blastLocation == " default" ) || (blastLocation == " clear" )){
+ string blastLocation = m->mothurProgramPath;
+
+ m->mothurOut (" Blast Location=" + blastLocation); m->mothurOutEndLine ();
+ m->setBlastPath (blastLocation);
+ }else {
+ if (m->dirCheck (blastLocation)) {
+ m->mothurOut (" Blast Location=" + blastLocation); m->mothurOutEndLine ();
+ m->setBlastPath (blastLocation);
+ }
+ }
+
}
return 0 ;
}
0 comments on commit
3c6e19e