Permalink
Browse files

Minor edits

  • Loading branch information...
1 parent 58430e4 commit 5562475076351a4df206eb7310db085cf041aa33 @mothur-westcott mothur-westcott committed Feb 16, 2017
@@ -825,6 +825,10 @@ unsigned long long MakeContigsCommand::processSingleFileOption(map<string, int>&
//**********************************************************************************************************************
unsigned long long MakeContigsCommand::processMultipleFileOption(map<string, int>& totalGroupCounts, vector<string>& theseOutputFileNames, map<string, string>& theseAllFileNames) {
try {
+
+ //read file
+ vector< vector<string> > fileInputs = readFileNames(file); if (m->control_pressed) { return 0; }
+
unsigned long long numReads = 0;
map<string, string> cvars;
@@ -861,10 +865,6 @@ unsigned long long MakeContigsCommand::processMultipleFileOption(map<string, int
theseOutputFileNames.push_back(compositeQualFile);
theseOutputFileNames.push_back(compositeMisMatchFile);
-
- //read file
- vector< vector<string> > fileInputs = readFileNames(file);
-
if (gz) {
numReads = createProcessesGroups(fileInputs, compositeGroupFile, compositeFastaFile, compositeScrapFastaFile, compositeQualFile, compositeScrapQualFile, compositeMisMatchFile, totalGroupCounts, theseAllFileNames); theseOutputFileNames.push_back(compositeGroupFile);
}else {
@@ -2976,6 +2976,9 @@ vector< vector<string> > MakeContigsCommand::readFileNames(string filename){
bool skip = false;
string line = m->getline(in); m->gobble(in);
+
+ if (m->debug) { m->mothurOut("[DEBUG]: " + line +"\n"); }
+
vector<string> pieces = m->splitWhiteSpace(line);
string group = "";
@@ -3267,6 +3270,8 @@ vector< vector<string> > MakeContigsCommand::readFileNames(string filename){
gz = true;
}else { gz = false; }
+ if (files.size() == 0) { m->control_pressed = true; }
+
return files;
}
catch(exception& e) {
@@ -1161,16 +1161,14 @@ int PcrSeqsCommand::readGroup(set<string> names){
while(!in.eof()){
if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
- in >> name; //read from first column
- in >> group; //read from second column
+ in >> name; m->gobble(in); //read from first column
+ in >> group; m->gobble(in); //read from second column
//if this name is in the accnos file
if (names.count(name) == 0) {
wroteSomething = true;
out << name << '\t' << group << endl;
}else { removedCount++; }
-
- m->gobble(in);
}
in.close();
out.close();
@@ -469,7 +469,8 @@ RenameFileCommand::RenameFileCommand(string option) {
if (outputfile == "not found") {
if (!mothurGenerated) { m->mothurOut("[ERROR]: you must enter an output file name"); m->mothurOutEndLine(); abort=true; }
outputfile = "";
- }else { mothurGenerated=false; }
+ }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;
View
@@ -45,8 +45,8 @@ InteractEngine::InteractEngine(string path){
#ifdef MOTHUR_FILES
#else
//set default location to search for files to mothur's executable location. This will resolve issue of double-clicking on the executable which opens mothur and sets pwd to your home directory instead of the mothur directory and leads to "unable to find file" errors.
- string tempDefault = path.substr(0, (path.find_last_of('m')));
- if (tempDefault != "") { mout->setDefaultPath(tempDefault); }
+ //string tempDefault = path.substr(0, (path.find_last_of('m')));
+ mout->setDefaultPath(mout->mothurProgramPath);
#endif
}
@@ -184,8 +184,7 @@ BatchEngine::BatchEngine(string path, string batchFileName){
#ifdef MOTHUR_FILES
#else
//set default location to search for files to mothur's executable location. This will resolve issue of double-clicking on the executable which opens mothur and sets pwd to your home directory instead of the mothur directory and leads to "unable to find file" errors.
- string tempDefault = path.substr(0, (path.find_last_of('m')));
- if (tempDefault != "") { mout->setDefaultPath(tempDefault); }
+ mout->setDefaultPath(mout->mothurProgramPath);
#endif
@@ -321,8 +320,7 @@ ScriptEngine::ScriptEngine(string path, string commandString){
#ifdef MOTHUR_FILES
#else
//set default location to search for files to mothur's executable location. This will resolve issue of double-clicking on the executable which opens mothur and sets pwd to your home directory instead of the mothur directory and leads to "unable to find file" errors.
- string tempDefault = path.substr(0, (path.find_last_of('m')));
- if (tempDefault != "") { mout->setDefaultPath(tempDefault); }
+ mout->setDefaultPath(mout->mothurProgramPath);
#endif
View
@@ -309,14 +309,16 @@ void MothurOut::setFileName(string filename) {
void MothurOut::setDefaultPath(string pathname) {
try {
- //add / to name if needed
- string lastChar = pathname.substr(pathname.length()-1);
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
- if (lastChar != "/") { pathname += "/"; }
- #else
- if (lastChar != "\\") { pathname += "\\"; }
- #endif
-
+ if (pathname != "") {
+ //add / to name if needed
+ string lastChar = pathname.substr(pathname.length()-1);
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+ if (lastChar != "/") { pathname += "/"; }
+#else
+ if (lastChar != "\\") { pathname += "\\"; }
+#endif
+ }
+
defaultPath = getFullPathName(pathname);
}
@@ -329,14 +331,15 @@ void MothurOut::setDefaultPath(string pathname) {
void MothurOut::setBlastPath(string pathname) {
try {
- //add / to name if needed
- string lastChar = pathname.substr(pathname.length()-1);
+ if (pathname != "") {
+ //add / to name if needed
+ string lastChar = pathname.substr(pathname.length()-1);
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
- if (lastChar != "/") { pathname += "/"; }
+ if (lastChar != "/") { pathname += "/"; }
#else
- if (lastChar != "\\") { pathname += "\\"; }
+ if (lastChar != "\\") { pathname += "\\"; }
#endif
-
+ }
blastPath = getFullPathName(pathname);
}

0 comments on commit 5562475

Please sign in to comment.