]> git.donarmstrong.com Git - mothur.git/blobdiff - errorchecking.cpp
added get.repseqs command, started matrix output command
[mothur.git] / errorchecking.cpp
index b460987ae401827664d14cdc5645905e0d673d8e..19d1f8aeacf25878fee069f1083b0465974d4645 100644 (file)
@@ -119,7 +119,6 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "ends" )                       { ends = value; }
                                if (parameter == "processors" )         { processors = value;   }
                                if (parameter == "size" )                       { size = value; }
-
                                if (parameter == "template")            { templatefile = value; }
                                if (parameter == "search")                      { search = value;               }
                                if (parameter == "ksize")                       { ksize = value;                }
@@ -178,7 +177,7 @@ bool ErrorCheck::checkInput(string input) {
                                if (parameter == "mismatch")            { mismatch = value;         }
                                if (parameter == "gapopen")                     { gapopen = value;              }
                                if (parameter == "gapextend" )          { gapextend = value;    }
-
+                               
                        }
                }
                
@@ -278,6 +277,13 @@ bool ErrorCheck::checkInput(string input) {
                        validateBinFiles();
                }
                
+               if ((commandName == "get.repseqs")) { 
+                       if ((globaldata->getListFile() == "")) { cout << "You must read a list file before you can use the get.repseqs command." << endl; return false; }
+                       else if (groupfile == "") { cout << "You must provide a groupfile before you can use the get.repseqs command." << endl; return false; }
+                       validateBinFiles();
+               }
+
+               
                if ((commandName == "get.oturep")) { 
                        if ((globaldata->gSparseMatrix == NULL) || (globaldata->gListVector == NULL)) {
                                cout << "Before you use the get.oturep command, you first need to read in a distance matrix." << endl; 
@@ -609,7 +615,7 @@ void ErrorCheck::validateBinFiles() {
                int ableToOpen;
                
                if (fastafile == "") {
-                               cout << "fasta is a required parameter for bin.seqs and get.oturep commands." << endl; errorFree = false; 
+                               cout << "fasta is a required parameter for bin.seqs, get.oturep and get.repseqs commands." << endl; errorFree = false; 
                }else if (fastafile != "") {
                        //is it a valid filename'
                        ableToOpen = openInputFile(fastafile, filehandle);
@@ -636,9 +642,17 @@ void ErrorCheck::validateBinFiles() {
                        filehandle.close();
                        //unable to open
                        if (ableToOpen == 1) {  errorFree = false; }
+               }else if (groupfile != "") {
+                       //is it a valid filename'
+                       ifstream filehandle;
+                       int ableToOpen = openInputFile(groupfile, filehandle);
+                       filehandle.close();
+                       //unable to open
+                       if (ableToOpen == 1) {  errorFree = false; }
                }
 
 
+
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateBinFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";