]> git.donarmstrong.com Git - mothur.git/commitdiff
added current as option is lists of file names, processors now outputted with current...
authorwestcott <westcott>
Tue, 26 Apr 2011 19:44:22 +0000 (19:44 +0000)
committerwestcott <westcott>
Tue, 26 Apr 2011 19:44:22 +0000 (19:44 +0000)
21 files changed:
aligncommand.cpp
chimerabellerophoncommand.cpp
chimeraccodecommand.cpp
chimeracheckcommand.cpp
chimerapintailcommand.cpp
chimeraslayercommand.cpp
classifyseqscommand.cpp
decalc.cpp
degapseqscommand.cpp
filterseqscommand.cpp
getcurrentcommand.cpp
makegroupcommand.cpp
mothurout.cpp
mothurout.h
pairwiseseqscommand.cpp
screenseqscommand.cpp
screenseqscommand.h
setcurrentcommand.cpp
setcurrentcommand.h
sffinfocommand.cpp
trimflowscommand.cpp

index 60a1dc2f7c93818450cc60e839e91fdd9aac3fa4..a75f9d0f944947f8d941731c0322444e68d40682 100644 (file)
@@ -167,50 +167,64 @@ AlignCommand::AlignCommand(string option)  {
                                for (int i = 0; i < candidateFileNames.size(); i++) {
                                        //candidateFileNames[i] = m->getFullPathName(candidateFileNames[i]);
                                        
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(candidateFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       candidateFileNames[i] = inputDir + candidateFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
-                                       ableToOpen = m->openInputFile(candidateFileNames[i], in, "noerror");
-                                       in.close();     
-                                       
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(candidateFileNames[i]);
-                                                       m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       candidateFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (candidateFileNames[i] == "current") { 
+                                               candidateFileNames[i] = m->getFastaFile(); 
+                                               if (candidateFileNames[i] != "") {  m->mothurOut("Using " + candidateFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       candidateFileNames.erase(candidateFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try output location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(candidateFileNames[i]);
-                                                       m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       candidateFileNames[i] = tryPath;
-                                               }
-                                       }
+                                       if (!ignore) {
                                        
-                                                                       
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(candidateFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       candidateFileNames[i] = inputDir + candidateFileNames[i];               }
+                                               }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               ableToOpen = m->openInputFile(candidateFileNames[i], in, "noerror");
+                                               in.close();     
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(candidateFileNames[i]);
+                                                               m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               candidateFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try output location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(candidateFileNames[i]);
+                                                               m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               candidateFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                                                               
 
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               candidateFileNames.erase(candidateFileNames.begin()+i);
-                                               i--;
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       candidateFileNames.erase(candidateFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
-                                       
                                }
                                
                                //make sure there is at least one valid file left
index db0a04cec1903f244186dcaafb3e28524b3178f5..1fcb4fc2956023801d72b9242429b544715bc247 100644 (file)
@@ -113,50 +113,65 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
-
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                       
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       in.close();
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
 
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
-                                       
                                }
                                
                                //make sure there is at least one valid file left
index 2586e2801d5071944b6acfa36cac330a9d26694e..d9dfe16d68340a53468845daeab06bc5fdc3728a 100644 (file)
@@ -127,48 +127,64 @@ ChimeraCcodeCommand::ChimeraCcodeCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
                                        
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
-                                               }
-                                       }
+                                       if (!ignore) {
                                        
-                                       in.close();
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
+                                               }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
index 067babdc82207025b7647b5d552c5e3706f8b5d1..c28934c5c525bbe4954b00181b512876d6cee29e 100644 (file)
@@ -124,48 +124,65 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
                                        
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
-                                               }
-                                       }
+                                       if (!ignore) {
                                        
-                                       in.close();
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] +". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
+                                               }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
+                                       
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] +". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
@@ -187,50 +204,65 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < nameFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(nameFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       nameFileNames[i] = inputDir + nameFileNames[i];         }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
                                        
-                                       ableToOpen = m->openInputFile(nameFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
-                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       nameFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (nameFileNames[i] == "current") { 
+                                               nameFileNames[i] = m->getNameFile(); 
+                                               if (nameFileNames[i] != "") {  m->mothurOut("Using " + nameFileNames[i] + " as input file for the name parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current namefile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       nameFileNames.erase(nameFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
-                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       nameFileNames[i] = tryPath;
-                                               }
-                                       }
+                                       if (!ignore) {
                                        
-                                       in.close();
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(nameFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       nameFileNames[i] = inputDir + nameFileNames[i];         }
+                                               }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(nameFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               nameFileNames.erase(nameFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
+                                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               nameFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
+                                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               nameFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       nameFileNames.erase(nameFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
-                                       
                                }
                                
                                //make sure there is at least one valid file left
index f8615540522ea583987a25ac5643d72cc9af6610..b11887d8cdddc110490e436777422dc0b0d86105 100644 (file)
@@ -148,47 +148,63 @@ ChimeraPintailCommand::ChimeraPintailCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
                                        
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                       
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
-
-                                       in.close();
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
index 9b49a4f3b4fdad3b1468abbbe512067b25c6c023..40e074c80c2d3a56136cb48f4fb20d95ebfd2456 100644 (file)
@@ -27,7 +27,7 @@ vector<string> ChimeraSlayerCommand::setParameters(){
                CommandParameter pminbs("minbs", "Number", "", "90", "", "", "",false,false); parameters.push_back(pminbs);
                CommandParameter psearch("search", "Multiple", "kmer-blast-distance", "distance", "", "", "",false,false); parameters.push_back(psearch);
                CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
-               CommandParameter prealign("realign", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(prealign);
+               CommandParameter prealign("realign", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(prealign);
                CommandParameter ptrim("trim", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(ptrim);
                CommandParameter psplit("split", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(psplit);
                CommandParameter pnumwanted("numwanted", "Number", "", "15", "", "", "",false,false); parameters.push_back(pnumwanted);
@@ -148,47 +148,63 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
                                        
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                               
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
-                                       
-                                       in.close();
+               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
@@ -206,47 +222,63 @@ ChimeraSlayerCommand::ChimeraSlayerCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < nameFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(nameFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       nameFileNames[i] = inputDir + nameFileNames[i];         }
-                                       }
                                        
-                                       int ableToOpen;
-                                       ifstream in;
-                                       
-                                       ableToOpen = m->openInputFile(nameFileNames[i], in, "noerror");
-                                       
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
-                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       nameFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (nameFileNames[i] == "current") { 
+                                               nameFileNames[i] = m->getNameFile(); 
+                                               if (nameFileNames[i] != "") {  m->mothurOut("Using " + nameFileNames[i] + " as input file for the name parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current namefile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       nameFileNames.erase(nameFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
-                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       nameFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                               
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(nameFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       nameFileNames[i] = inputDir + nameFileNames[i];         }
+                                               }
+                                               
+                                               int ableToOpen;
+                                               ifstream in;
+                                               
+                                               ableToOpen = m->openInputFile(nameFileNames[i], in, "noerror");
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(nameFileNames[i]);
+                                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               nameFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(nameFileNames[i]);
+                                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               nameFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       nameFileNames.erase(nameFileNames.begin()+i);
+                                                       i--;
                                                }
-                                       }
-                                       
-                                       in.close();
-                                       
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               nameFileNames.erase(nameFileNames.begin()+i);
-                                               i--;
                                        }
                                }
                                
index 1619656e792cfa14ea1bec54d558cf560a61861d..9d5a625308f8970888833ec7e74ec4b2e2ec32dd 100644 (file)
@@ -182,47 +182,63 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-                                       
-                                       int ableToOpen;
                                        
-                                       ifstream in;
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                               
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
-                                       
-                                       in.close();
+                                               
+                                               int ableToOpen;
+                                               
+                                               ifstream in;
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                        
                                }
@@ -249,47 +265,61 @@ ClassifySeqsCommand::ClassifySeqsCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < namefileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(namefileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       namefileNames[i] = inputDir + namefileNames[i];         }
-                                       }
-                                       int ableToOpen;
-                                       
-                                       ifstream in;
-                                       ableToOpen = m->openInputFile(namefileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(namefileNames[i]);
-                                                       m->mothurOut("Unable to open " + namefileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       namefileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (namefileNames[i] == "current") { 
+                                               namefileNames[i] = m->getNameFile(); 
+                                               if (namefileNames[i] != "") {  m->mothurOut("Using " + namefileNames[i] + " as input file for the name parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current namefile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       namefileNames.erase(namefileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(namefileNames[i]);
-                                                       m->mothurOut("Unable to open " + namefileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       namefileNames[i] = tryPath;
+                                       if (!ignore) {
+                                               
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(namefileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       namefileNames[i] = inputDir + namefileNames[i];         }
                                                }
-                                       }
-                                       in.close();
+                                               int ableToOpen;
+                                               
+                                               ifstream in;
+                                               ableToOpen = m->openInputFile(namefileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + namefileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();  abort = true;
-                                               //erase from file list
-                                               namefileNames.erase(namefileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(namefileNames[i]);
+                                                               m->mothurOut("Unable to open " + namefileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               namefileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(namefileNames[i]);
+                                                               m->mothurOut("Unable to open " + namefileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               namefileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + namefileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();  abort = true;
+                                                       //erase from file list
+                                                       namefileNames.erase(namefileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
-
                                }
                        }
 
index 609b8959036cef53e97db2a439ae5b12c6373135..67258714aa3b45cbdeaee2cf8d43576f2de4f446 100644 (file)
@@ -867,11 +867,12 @@ vector<Sequence*> DeCalculator::findClosest(Sequence* querySeq, vector<Sequence*
 //cout << numWanted << endl;
                for (int i = 0; i < numWanted; i++) {
 //                     cout << db[dists[i].index]->getName() << '\t' << dists[i].dist << endl;
-
-                       Sequence* temp = new Sequence(db[dists[i].index]->getName(), db[dists[i].index]->getAligned()); //have to make a copy so you can trim and filter without stepping on eachother.
+                       if (db[dists[i].index]->getName() != querySeq->getName()) {
+                               Sequence* temp = new Sequence(db[dists[i].index]->getName(), db[dists[i].index]->getAligned()); //have to make a copy so you can trim and filter without stepping on eachother.
                        
-                       seqsMatches.push_back(temp);
-                       indexes.push_back(dists[i].index);
+                               seqsMatches.push_back(temp);
+                               indexes.push_back(dists[i].index);
+                       }
                }
                
                return seqsMatches;
index 00f627dac6d9bbd8b89a44d7d5536ef5bc8d068f..c90064f190af3421a2f3f6ebc673b1265a1f202a 100644 (file)
@@ -101,46 +101,61 @@ DegapSeqsCommand::DegapSeqsCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       ifstream in;
-                                       int ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
-                                               }
-                                       }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       in.close();
+                                       if (!ignore) {
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
+                                               }
+               
+                                               ifstream in;
+                                               int ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
index a677eef9729ef5f1035db03f0a5daff9f7280e36..613dfda1dbbfcc74bea7e218fff53850c366fd7c 100644 (file)
@@ -132,51 +132,66 @@ FilterSeqsCommand::FilterSeqsCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastafileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastafileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastafileNames[i] = inputDir + fastafileNames[i];               }
-                                       }
-
-                                       ifstream in;
-                                       int ableToOpen = m->openInputFile(fastafileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastafileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastafileNames[i] = tryPath;
-                                               }
-                                       }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastafileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastafileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastafileNames[i] == "current") { 
+                                               fastafileNames[i] = m->getFastaFile(); 
+                                               if (fastafileNames[i] != "") {  m->mothurOut("Using " + fastafileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastafileNames.erase(fastafileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       in.close();
+                                       if (!ignore) {
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastafileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastafileNames[i] = inputDir + fastafileNames[i];               }
+                                               }
+
+                                               ifstream in;
+                                               int ableToOpen = m->openInputFile(fastafileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastafileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
-                                               //erase from file list
-                                               fastafileNames.erase(fastafileNames.begin()+i);
-                                               i--;
-                                       }else{  
-                                               string simpleName = m->getSimpleName(fastafileNames[i]);
-                                               filterFileName += simpleName.substr(0, simpleName.find_first_of('.'));
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastafileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastafileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastafileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastafileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastafileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastafileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
+                                                       //erase from file list
+                                                       fastafileNames.erase(fastafileNames.begin()+i);
+                                                       i--;
+                                               }else{  
+                                                       string simpleName = m->getSimpleName(fastafileNames[i]);
+                                                       filterFileName += simpleName.substr(0, simpleName.find_first_of('.'));
+                                               }
+                                               in.close();
                                        }
-                                       in.close();
                                }
                                
                                //make sure there is at least one valid file left
index 9289ba6da677a6e91f989a3b15c5f407d32ce3f8..5f5235647d28168d4ca187189d5911266a24c71a 100644 (file)
@@ -135,6 +135,10 @@ int GetCurrentCommand::execute(){
                                        m->setAccnosFile("");
                                }else if (types[i] == "taxonomy") {
                                        m->setTaxonomyFile("");
+                               }else if (types[i] == "flow") {
+                                       m->setFlowFile("");
+                               }else if (types[i] == "processors") {
+                                       m->setProcessors("1");
                                }else if (types[i] == "all") {
                                        m->clearCurrentFiles();
                                }else {
index 326a96ee113a270595469835cce7dd3431d54622..7ca4aa64d28f9ec23bcc93c37e42c753ef6a8137 100644 (file)
@@ -102,46 +102,64 @@ MakeGroupCommand::MakeGroupCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       ifstream in;
-                                       int ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  
+                                                       m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); 
+                                                       filename += m->getRootName(m->getSimpleName(fastaFileNames[i]));
+                                               }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
-                                       in.close();
+               
+                                               ifstream in;
+                                               int ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
-                                       }else{  filename += m->getRootName(m->getSimpleName(fastaFileNames[i]));  }
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }else{  filename += m->getRootName(m->getSimpleName(fastaFileNames[i]));  }
+                                       }
                                }
                                
                                //prevent giantic file name
index 65296221759fa879e591bb0967b0f20872106adc..2b06799f3c91f58c3c72ed63c2a6098d0473675e 100644 (file)
@@ -39,6 +39,8 @@ void MothurOut::printCurrentFiles()  {
                if (sharedfile != "")           {  mothurOut("shared=" + sharedfile); mothurOutEndLine();                       }
                if (taxonomyfile != "")         {  mothurOut("taxonomy=" + taxonomyfile); mothurOutEndLine();           }
                if (treefile != "")                     {  mothurOut("tree=" + treefile); mothurOutEndLine();                           }
+               if (flowfile != "")                     {  mothurOut("flow=" + flowfile); mothurOutEndLine();                           }
+               if (processors != "1")          {  mothurOut("processors=" + processors); mothurOutEndLine();           }
                
        }
        catch(exception& e) {
@@ -70,6 +72,8 @@ bool MothurOut::hasCurrentFiles()  {
                if (sharedfile != "")           {  return true;                 }
                if (taxonomyfile != "")         {  return true;                 }
                if (treefile != "")                     {  return true;                 }
+               if (flowfile != "")                     {  return true;                 }
+               if (processors != "1")          {  return true;                 }
                
                return hasCurrent;
                
@@ -101,7 +105,9 @@ void MothurOut::clearCurrentFiles()  {
                sfffile = "";
                oligosfile = "";
                accnosfile = "";
-               taxonomyfile = "";              
+               taxonomyfile = "";      
+               flowfile = "";
+               processors = "1";
        }
        catch(exception& e) {
                errorOut(e, "MothurOut", "clearCurrentFiles");
index 9446bf9bd5c2b3c150b02944c7d8f87aeef95dca..f6f505dce6409db716561b061a2e66eda3efae5a 100644 (file)
@@ -118,6 +118,7 @@ class MothurOut {
                string getOligosFile()          { return oligosfile;            }
                string getAccnosFile()          { return accnosfile;            }
                string getTaxonomyFile()        { return taxonomyfile;          }
+               string getFlowFile()            { return flowfile;                      }
                string getProcessors()          { return processors;            }
                
                void setListFile(string f)                      { listfile = getFullPathName(f);                        }
@@ -139,6 +140,7 @@ class MothurOut {
                void setOligosFile(string f)            { oligosfile = getFullPathName(f);                      }
                void setAccnosFile(string f)            { accnosfile = getFullPathName(f);                      }
                void setTaxonomyFile(string f)          { taxonomyfile = getFullPathName(f);            }
+               void setFlowFile(string f)                      { flowfile = getFullPathName(f);                        }
                void setProcessors(string p)            { processors = p;                                                       }
                
                void printCurrentFiles();
@@ -171,6 +173,7 @@ class MothurOut {
                        accnosfile = "";
                        taxonomyfile = "";
                        processors = "1";
+                       flowfile = "";
                        gui = false;
                };
                ~MothurOut();
@@ -180,7 +183,7 @@ class MothurOut {
                string releaseDate, version;
        
                string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
-               string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors;
+               string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
 
        
                ofstream out;
index 9866753329374dc768433488a7d4943555bb1b77..1aa133f38c379fd40c495d2c2a844de292c17f51 100644 (file)
@@ -141,48 +141,63 @@ PairwiseSeqsCommand::PairwiseSeqsCommand(string option)  {
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < fastaFileNames.size(); i++) {
                                        
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(fastaFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
-                                       }
-       
-                                       int ableToOpen;
-                                       ifstream in;
-
-                                       ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (fastaFileNames[i] == "current") { 
+                                               fastaFileNames[i] = m->getFastaFile(); 
+                                               if (fastaFileNames[i] != "") {  m->mothurOut("Using " + fastaFileNames[i] + " as input file for the fasta parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current fastafile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try output location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
-                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       fastaFileNames[i] = tryPath;
+                                       if (!ignore) {
+                                       
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(fastaFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       fastaFileNames[i] = inputDir + fastaFileNames[i];               }
                                                }
-                                       }
+               
+                                               int ableToOpen;
+                                               ifstream in;
+
+                                               ableToOpen = m->openInputFile(fastaFileNames[i], in, "noerror");
                                        
-                                       in.close();                                     
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try output location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
+                                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               fastaFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();                                     
 
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
-                                               //erase from file list
-                                               fastaFileNames.erase(fastaFileNames.begin()+i);
-                                               i--;
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); 
+                                                       //erase from file list
+                                                       fastaFileNames.erase(fastaFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
index 0b7f3f09abbd26026de0cb2602d08d0a0e4fa514..7318f9060cdbf5fa2aa5d23205163c1dfecc048a 100644 (file)
@@ -16,6 +16,7 @@ vector<string> ScreenSeqsCommand::setParameters(){
                CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfasta);
                CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
                CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pgroup);
+               CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pqfile);
                CommandParameter palignreport("alignreport", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(palignreport);
                CommandParameter pstart("start", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pstart);
                CommandParameter pend("end", "Number", "", "-1", "", "", "",false,false); parameters.push_back(pend);
@@ -43,7 +44,7 @@ string ScreenSeqsCommand::getHelpString(){
        try {
                string helpString = "";
                helpString += "The screen.seqs command reads a fastafile and creates .....\n";
-               helpString += "The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, group, optimize, criteria and processors.\n";
+               helpString += "The screen.seqs command parameters are fasta, start, end, maxambig, maxhomop, minlength, maxlength, name, group, qfile, optimize, criteria and processors.\n";
                helpString += "The fasta parameter is required.\n";
                helpString += "The start parameter .... The default is -1.\n";
                helpString += "The end parameter .... The default is -1.\n";
@@ -78,6 +79,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(){
                outputTypes["group"] = tempOutNames;
                outputTypes["alignreport"] = tempOutNames;
                outputTypes["accnos"] = tempOutNames;
+               outputTypes["qfile"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "ScreenSeqsCommand", "ScreenSeqsCommand");
@@ -114,6 +116,7 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option)  {
                        outputTypes["group"] = tempOutNames;
                        outputTypes["alignreport"] = tempOutNames;
                        outputTypes["accnos"] = tempOutNames;
+                       outputTypes["qfile"] = tempOutNames;
                        
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
@@ -151,6 +154,15 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option)  {
                                        //if the user has not given a path then, add inputdir. else leave path alone.
                                        if (path == "") {       parameters["alignreport"] = inputDir + it->second;              }
                                }
+                               
+                               it = parameters.find("qfile");
+                               //user has given a template file
+                               if(it != parameters.end()){ 
+                                       path = m->hasPath(it->second);
+                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                       if (path == "") {       parameters["qfile"] = inputDir + it->second;            }
+                               }
+                               
                        }
 
                        //check for required parameters
@@ -166,6 +178,10 @@ ScreenSeqsCommand::ScreenSeqsCommand(string option)  {
                        if (groupfile == "not open") { abort = true; }  
                        else if (groupfile == "not found") { groupfile = ""; }
                        
+                       qualfile = validParameter.validFile(parameters, "qfile", true);
+                       if (qualfile == "not open") { abort = true; }   
+                       else if (qualfile == "not found") { qualfile = ""; }
+                       
                        namefile = validParameter.validFile(parameters, "name", true);
                        if (namefile == "not open") { namefile = ""; abort = true; }
                        else if (namefile == "not found") { namefile = ""; }    
@@ -461,6 +477,7 @@ int ScreenSeqsCommand::execute(){
                if (m->control_pressed) { remove(goodSeqFile.c_str());  return 0; }
 
                if(alignreport != "")                                   {       screenAlignReport(badSeqNames);         }
+               if(qualfile != "")                                              {       screenQual(badSeqNames);                        }
                
                if (m->control_pressed) { remove(goodSeqFile.c_str());  return 0; }
                
@@ -492,6 +509,11 @@ int ScreenSeqsCommand::execute(){
                if (itTypes != outputTypes.end()) {
                        if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
                }
+               
+               itTypes = outputTypes.find("qfile");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+               }
 
                m->mothurOut("It took " + toString(time(NULL) - start) + " secs to screen " + toString(numFastaSeqs) + " sequences.");
                m->mothurOutEndLine();
@@ -906,6 +928,79 @@ int ScreenSeqsCommand::screenAlignReport(set<string> badSeqNames){
                exit(1);
        }
        
+}
+//***************************************************************************************************************
+
+int ScreenSeqsCommand::screenQual(set<string> badSeqNames){
+       try {
+               ifstream in;
+               m->openInputFile(qualfile, in);
+               set<string>::iterator it;
+               
+               string goodQualFile = outputDir + m->getRootName(m->getSimpleName(qualfile)) + "good" + m->getExtension(qualfile);
+               outputNames.push_back(goodQualFile);  outputTypes["qfile"].push_back(goodQualFile);
+               ofstream goodQual;      m->openOutputFile(goodQualFile, goodQual);
+               
+               while(!in.eof()){       
+                       
+                       if (m->control_pressed) { goodQual.close(); in.close(); remove(goodQualFile.c_str()); return 0; }
+
+                       string saveName = "";
+                       string name = "";
+                       string scores = "";
+                       
+                       in >> name; 
+                       
+                       if (name.length() != 0) { 
+                               saveName = name.substr(1);
+                               while (!in.eof())       {       
+                                       char c = in.get(); 
+                                       if (c == 10 || c == 13){        break;  }
+                                       else { name += c; }     
+                               } 
+                               m->gobble(in);
+                       }
+                       
+                       while(in){
+                               char letter= in.get();
+                               if(letter == '>'){      in.putback(letter);     break;  }
+                               else{ scores += letter; }
+                       }
+                       
+                       m->gobble(in);
+                       
+                       it = badSeqNames.find(saveName);
+                       
+                       if(it != badSeqNames.end()){
+                               badSeqNames.erase(it);
+                       }else{                          
+                               goodQual << name << endl << scores;
+                       }
+                       
+                       m->gobble(in);
+               }
+               
+               in.close();
+               goodQual.close();
+               
+               //we were unable to remove some of the bad sequences
+               if (badSeqNames.size() != 0) {
+                       for (it = badSeqNames.begin(); it != badSeqNames.end(); it++) {  
+                               m->mothurOut("Your qual file does not include the sequence " + *it + " please correct."); 
+                               m->mothurOutEndLine();
+                       }
+               }
+               
+               if (m->control_pressed) {  remove(goodQualFile.c_str());  return 0; }
+               
+               return 0;
+               
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ScreenSeqsCommand", "screenQual");
+               exit(1);
+       }
+       
 }
 //**********************************************************************************************************************
 
index b8ab242e187b2f1b0fccc8b087e7c17f2cc0c903..602326c42e2ff75afbeb8050479cf7e188b8b634 100644 (file)
@@ -42,6 +42,7 @@ private:
        int screenNameGroupFile(set<string>);
        int screenGroupFile(set<string>);
        int screenAlignReport(set<string>);
+       int screenQual(set<string>);
        
        int driver(linePair*, string, string, string, set<string>&);
        int createProcesses(string, string, string, set<string>&);
@@ -51,7 +52,7 @@ private:
        #endif
 
        bool abort;
-       string fastafile, namefile, groupfile, alignreport, outputDir;
+       string fastafile, namefile, groupfile, alignreport, outputDir, qualfile;
        int startPos, endPos, maxAmbig, maxHomoP, minLength, maxLength, processors, criteria;
        vector<string> outputNames;
        vector<string> optimize;
index 16685b24c7c706d0c6cf5aa9d15da2e08e863112..75d1f943e37a157f66d82987a74b527a0bc5cec3 100644 (file)
@@ -12,7 +12,9 @@
 //**********************************************************************************************************************
 vector<string> SetCurrentCommand::setParameters(){     
        try {
-                       
+               
+               CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
+               CommandParameter pflow("flow", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pflow);
                CommandParameter pphylip("phylip", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pphylip);
                CommandParameter pcolumn("column", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pcolumn);
                CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pfasta);
@@ -261,6 +263,14 @@ SetCurrentCommand::SetCurrentCommand(string option)  {
                                        //if the user has not given a path then, add inputdir. else leave path alone.
                                        if (path == "") {       parameters["taxonomy"] = inputDir + it->second;         }
                                }
+                               
+                               it = parameters.find("flow");
+                               //user has given a template file
+                               if(it != parameters.end()){ 
+                                       path = m->hasPath(it->second);
+                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                       if (path == "") {       parameters["flow"] = inputDir + it->second;             }
+                               }
                        }
                        
                        //check for parameters
@@ -359,6 +369,15 @@ SetCurrentCommand::SetCurrentCommand(string option)  {
                        else if (taxonomyfile == "not found") {  taxonomyfile = "";  }  
                        if (taxonomyfile != "") { m->setTaxonomyFile(taxonomyfile); }
                        
+                       flowfile = validParameter.validFile(parameters, "flow", true);
+                       if (flowfile == "not open") { m->mothurOut("Ignoring: " + parameters["flow"]); m->mothurOutEndLine(); flowfile = ""; }
+                       else if (flowfile == "not found") {  flowfile = "";  }  
+                       if (flowfile != "") { m->setFlowFile(flowfile); }
+                       
+                       processors = validParameter.validFile(parameters, "processors", false);
+                       if (processors == "not found") {  processors = "1";  }  
+                       if (processors != "") { m->setProcessors(processors); }
+                       
                        clearTypes = validParameter.validFile(parameters, "clear", false);                      
                        if (clearTypes == "not found") { clearTypes = ""; }
                        else { m->splitAtDash(clearTypes, types);       }
@@ -422,6 +441,10 @@ int SetCurrentCommand::execute(){
                                        m->setAccnosFile("");
                                }else if (types[i] == "taxonomy") {
                                        m->setTaxonomyFile("");
+                               }else if (types[i] == "flow") {
+                                       m->setFlowFile("");
+                               }else if (types[i] == "processors") {
+                                       m->setProcessors("1");
                                }else if (types[i] == "all") {
                                        m->clearCurrentFiles();
                                }else {
index 5a40e4a20f97377e86d973c2412cc17e12e3fcb0..4ce90a2b1111b2feb428feaad96570c2a1363825 100644 (file)
@@ -37,7 +37,7 @@ private:
        vector<string> types;
        
        string accnosfile, phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, designfile, taxonomyfile;
-       string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile;
+       string orderfile, treefile, sharedfile, ordergroupfile, relabundfile, fastafile, qualfile, sfffile, oligosfile, processors, flowfile;
 
        
 };
index 5478ca4de30819bc55868aba9640f3d7a1385e9a..8c50247c6845867ff9f99f62760d81300d433779 100644 (file)
@@ -116,46 +116,60 @@ SffInfoCommand::SffInfoCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < filenames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(filenames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       filenames[i] = inputDir + filenames[i];         }
-                                       }
-       
-                                       ifstream in;
-                                       int ableToOpen = m->openInputFile(filenames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(filenames[i]);
-                                                       m->mothurOut("Unable to open " + filenames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       filenames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (filenames[i] == "current") { 
+                                               filenames[i] = m->getSFFFile(); 
+                                               if (filenames[i] != "") {  m->mothurOut("Using " + filenames[i] + " as input file for the sff parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current sfffile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       filenames.erase(filenames.begin()+i);
+                                                       i--;
                                                }
                                        }
                                        
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(filenames[i]);
-                                                       m->mothurOut("Unable to open " + filenames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       filenames[i] = tryPath;
+                                       if (!ignore) {
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(filenames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       filenames[i] = inputDir + filenames[i];         }
                                                }
-                                       }
-                                       
-                                       in.close();
+               
+                                               ifstream in;
+                                               int ableToOpen = m->openInputFile(filenames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + filenames[i] + ". It will be disregarded."); m->mothurOutEndLine();
-                                               //erase from file list
-                                               filenames.erase(filenames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(filenames[i]);
+                                                               m->mothurOut("Unable to open " + filenames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               filenames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(filenames[i]);
+                                                               m->mothurOut("Unable to open " + filenames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               filenames[i] = tryPath;
+                                                       }
+                                               }
+                                               
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + filenames[i] + ". It will be disregarded."); m->mothurOutEndLine();
+                                                       //erase from file list
+                                                       filenames.erase(filenames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
@@ -171,44 +185,59 @@ SffInfoCommand::SffInfoCommand(string option)  {
                                
                                //go through files and make sure they are good, if not, then disregard them
                                for (int i = 0; i < accnosFileNames.size(); i++) {
-                                       if (inputDir != "") {
-                                               string path = m->hasPath(accnosFileNames[i]);
-                                               //if the user has not given a path then, add inputdir. else leave path alone.
-                                               if (path == "") {       accnosFileNames[i] = inputDir + accnosFileNames[i];             }
-                                       }
-       
-                                       ifstream in;
-                                       int ableToOpen = m->openInputFile(accnosFileNames[i], in, "noerror");
-                               
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getDefaultPath() != "") { //default path is set
-                                                       string tryPath = m->getDefaultPath() + m->getSimpleName(accnosFileNames[i]);
-                                                       m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       accnosFileNames[i] = tryPath;
+                                       bool ignore = false;
+                                       if (accnosFileNames[i] == "current") { 
+                                               accnosFileNames[i] = m->getAccnosFile(); 
+                                               if (accnosFileNames[i] != "") {  m->mothurOut("Using " + accnosFileNames[i] + " as input file for the accnos parameter where you had given current."); m->mothurOutEndLine(); }
+                                               else {  
+                                                       m->mothurOut("You have no current accnosfile, ignoring current."); m->mothurOutEndLine(); ignore=true; 
+                                                       //erase from file list
+                                                       accnosFileNames.erase(accnosFileNames.begin()+i);
+                                                       i--;
                                                }
                                        }
-                                       //if you can't open it, try default location
-                                       if (ableToOpen == 1) {
-                                               if (m->getOutputDir() != "") { //default path is set
-                                                       string tryPath = m->getOutputDir() + m->getSimpleName(accnosFileNames[i]);
-                                                       m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ifstream in2;
-                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
-                                                       in2.close();
-                                                       accnosFileNames[i] = tryPath;
+                                       
+                                       if (!ignore) {
+                                       
+                                               if (inputDir != "") {
+                                                       string path = m->hasPath(accnosFileNames[i]);
+                                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                                       if (path == "") {       accnosFileNames[i] = inputDir + accnosFileNames[i];             }
                                                }
-                                       }
-                                       in.close();
+               
+                                               ifstream in;
+                                               int ableToOpen = m->openInputFile(accnosFileNames[i], in, "noerror");
                                        
-                                       if (ableToOpen == 1) { 
-                                               m->mothurOut("Unable to open " + accnosFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
-                                               //erase from file list
-                                               accnosFileNames.erase(accnosFileNames.begin()+i);
-                                               i--;
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getDefaultPath() != "") { //default path is set
+                                                               string tryPath = m->getDefaultPath() + m->getSimpleName(accnosFileNames[i]);
+                                                               m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               accnosFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               //if you can't open it, try default location
+                                               if (ableToOpen == 1) {
+                                                       if (m->getOutputDir() != "") { //default path is set
+                                                               string tryPath = m->getOutputDir() + m->getSimpleName(accnosFileNames[i]);
+                                                               m->mothurOut("Unable to open " + accnosFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
+                                                               ifstream in2;
+                                                               ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                               in2.close();
+                                                               accnosFileNames[i] = tryPath;
+                                                       }
+                                               }
+                                               in.close();
+                                               
+                                               if (ableToOpen == 1) { 
+                                                       m->mothurOut("Unable to open " + accnosFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
+                                                       //erase from file list
+                                                       accnosFileNames.erase(accnosFileNames.begin()+i);
+                                                       i--;
+                                               }
                                        }
                                }
                                
@@ -301,7 +330,12 @@ int SffInfoCommand::execute(){
                itTypes = outputTypes.find("qfile");
                if (itTypes != outputTypes.end()) {
                        if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
-               }       
+               }
+               
+               itTypes = outputTypes.find("flow");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFlowFile(current); }
+               }
                
                //report output filenames
                m->mothurOutEndLine();
index c4b5f43cc112861097b44829d6f4d300f9335d30..bb0fa0475d2bfbb344d025ae493a95c557712592 100644 (file)
@@ -136,8 +136,14 @@ TrimFlowsCommand::TrimFlowsCommand(string option)  {
                        
                        //check for required parameters
                        flowFileName = validParameter.validFile(parameters, "flow", true);
-                       if (flowFileName == "not found") { m->mothurOut("flow is a required parameter for the trim.flows command."); m->mothurOutEndLine(); abort = true; }
-                       else if (flowFileName == "not open") { abort = true; }  
+                       if (flowFileName == "not found") { 
+                               flowFileName = m->getFlowFile(); 
+                               if (flowFileName != "") {  m->mothurOut("Using " + flowFileName + " as input file for the flow parameter."); m->mothurOutEndLine(); }
+                               else { 
+                                       m->mothurOut("No valid current flow file. You must provide a flow file."); m->mothurOutEndLine(); 
+                                       abort = true;
+                               } 
+                       }else if (flowFileName == "not open") { flowFileName = ""; abort = true; }      
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){