]> git.donarmstrong.com Git - mothur.git/blobdiff - errorchecking.cpp
working on libshuff
[mothur.git] / errorchecking.cpp
index 430729d026ec5082416d2cdc118413dee290e48d..397bbd2315fff983687a1723cca46ab7808bf8b3 100644 (file)
@@ -355,7 +355,9 @@ bool ErrorCheck::checkInput(string input) {
                        }else if (listfile != "") { //you want to do single commands
                                validateReadFiles();
                                validateReadPhil();
-                       }else {//you are reading a shared file
+                       }else if ((listfile == "") && (sharedfile == "")) {
+                               cout << "You must enter either a listfile or a sharedfile with the read.otu command. " << endl; return false; 
+                       }else{//you are reading a shared file
                                validateReadFiles();
                        }
                }else if (commandName == "read.tree") { 
@@ -372,6 +374,10 @@ bool ErrorCheck::checkInput(string input) {
                                errorFree = false;
                } 
                
+               if ((commandName == "libshuff") && (globaldata->gMatrix == NULL)) {
+                        cout << "You must read in a matrix before you use the libshuff command. " << endl; return false; 
+               }
+               
                if (commandName == "parsimony") {
                        //are you trying to use parsimony without reading a tree or saying you want random distribution
                        if (randomtree == "")  {
@@ -429,7 +435,7 @@ void ErrorCheck::validateReadFiles() {
                        //unable to open
                        if (ableToOpen == 1) { errorFree = false; }
                        else { globaldata->inputFileName = phylipfile; }
-               //are we reading a phylipfile
+               //are we reading a columnfile
                }else if (columnfile != "") {
                        ableToOpen = openInputFile(columnfile, filehandle);
                        filehandle.close();
@@ -600,6 +606,13 @@ void ErrorCheck::validateReadDist() {
                ifstream filehandle;
                int ableToOpen;
                
+               if (groupfile != "") {
+                       ableToOpen = openInputFile(groupfile, filehandle);
+                       filehandle.close();
+                       //unable to open
+                       if (ableToOpen == 1) {  errorFree = false; }
+               }
+               
                if ((phylipfile == "") && (columnfile == "")) { cout << "When executing a read.dist you must enter a phylip or a column." << endl; errorFree = false; }
                else if ((phylipfile != "") && (columnfile != "")) { cout << "When executing a read.dist you must enter ONLY ONE of the following: phylip or column." << endl; errorFree = false; }