X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=errorchecking.cpp;h=b9b3100b20f6b840f5f296964a7dc6f8aefd5d3d;hb=485c02be0cdcd06ce08dd58d551a525b6a1b47c5;hp=5f587a9b83a1a140409fc0cbdfa4bba0169ea518;hpb=cfb66eb46a9678a751a8f21f3ea740dffd525f5e;p=mothur.git diff --git a/errorchecking.cpp b/errorchecking.cpp index 5f587a9..b9b3100 100644 --- a/errorchecking.cpp +++ b/errorchecking.cpp @@ -44,7 +44,10 @@ void ErrorCheck::refresh() { /******************************************************/ -ErrorCheck::~ErrorCheck() {} +ErrorCheck::~ErrorCheck() { + delete validCommand; + delete validParameter; +} /*******************************************************/ @@ -80,7 +83,7 @@ bool ErrorCheck::checkInput(string input) { splitAtComma(value, optionText); splitAtEquals(parameter, value); - //is it a valid parameter + //is it a valid parameter for the command if (validParameter->isValidParameter(parameter, commandName) != true) { return false; } if (parameter == "phylip" ) { phylipfile = value; } @@ -111,7 +114,8 @@ bool ErrorCheck::checkInput(string input) { if (errorFree) { //gets the last parameter and value value = optionText; splitAtEquals(parameter, value); - //is it a valid parameter + + //is it a valid parameter for the command if (validParameter->isValidParameter(parameter, commandName) != true) { return false; } if (parameter == "phylip" ) { phylipfile = value; } @@ -142,6 +146,7 @@ bool ErrorCheck::checkInput(string input) { //make sure the user does not use both the line and label parameters if ((line != "") && (label != "")) { cout << "You may use either the line or label parameters, but not both." << endl; return false; } + //check for valid files if (commandName == "read.dist") { validateReadFiles(); validateReadDist(); @@ -149,12 +154,15 @@ bool ErrorCheck::checkInput(string input) { //you want to do shared commands if ((listfile != "") && (groupfile != "")) { validateParseFiles(); //checks the listfile and groupfile parameters - }else if (listfile != "") { //you want to do single commands + //you want to do single commands + }else if ((listfile != "") || (rabundfile != "") || (sabundfile != "")){ validateReadFiles(); validateReadPhil(); - }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 + //you have not given a file + }else if ((listfile == "") && (sharedfile == "") && (rabundfile == "") && (sabundfile == "")) { + cout << "You must enter either a listfile, rabundfile, sabundfile or a sharedfile with the read.otu command. " << endl; return false; + //you want to do shared commands with a shared file + }else if (sharedfile != "") {//you are reading a shared file validateReadFiles(); } }else if (commandName == "read.tree") { @@ -171,8 +179,8 @@ 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 == "libshuff") && ((globaldata->gMatrix == NULL) || (globaldata->gGroupmap == NULL))) { + cout << "You must read in a matrix and groupfile using the read.dist command, before you use the libshuff command. " << endl; return false; } if (commandName == "parsimony") { @@ -210,6 +218,12 @@ bool ErrorCheck::checkInput(string input) { else if (globaldata->getGroupFile() == "") { cout << "You must read a list and a group, or a shared before you can use the collect.shared, rarefaction.shared or summary.shared commands." << endl; return false; } } } + + if (commandName == "heatmap"){ + if ((globaldata->getListFile() == "") && (globaldata->getSharedFile() == "")) { + cout << "You must read a list, or a list and a group, or a shared before you can use the heatmap command." << endl; return false; + } + } return errorFree; }