From 1b2517db06f3c6cd5f5c67198261361ce8dad611 Mon Sep 17 00:00:00 2001 From: westcott Date: Fri, 13 Feb 2009 17:29:04 +0000 Subject: [PATCH] minor error checking fixes --- errorchecking.cpp | 6 ++++-- globaldata.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/errorchecking.cpp b/errorchecking.cpp index 8556c27..7f581d9 100644 --- a/errorchecking.cpp +++ b/errorchecking.cpp @@ -140,7 +140,9 @@ 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; } - + + //make sure you have a valid random tree value + if ((randomtree != "0") && (randomtree != "1")) { cout << randomtree << " is not a valid randomtree value. Valid values for randomtree are 0, (meaning you have read your own trees) or 1 (meaning you want to random distribution of trees)." << endl; return false; } if (commandName == "read.dist") { validateReadFiles(); @@ -173,7 +175,7 @@ bool ErrorCheck::checkInput(string input) { if (commandName == "parsimony") { //are you trying to use parsimony without reading a tree or saying you want random distribution if (randomtree == "0") { - if ((globaldata->getTreeFile() == "") || (globaldata->getGroupFile() == "")) { + if (globaldata->gTree.size() == 0) { cout << "You must read a treefile and a groupfile or set the randomtree parameter to 1, before you may execute the parsimony command." << endl; return false; } } } diff --git a/globaldata.cpp b/globaldata.cpp index 0348ae6..9b740a6 100644 --- a/globaldata.cpp +++ b/globaldata.cpp @@ -74,6 +74,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree") || (commandName == "read.shared")) { clear(); gGroupmap = NULL; + gTree.clear(); } //saves help request -- 2.39.2