X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=globaldata.cpp;h=17b4908515179211b792a6d06801d2dc878a7bca;hb=3659285c05daa94306a7b61dd97ec945b23d472b;hp=9b740a68c1a6b945d4f12789a5ee125e308f2c8c;hpb=1b2517db06f3c6cd5f5c67198261361ce8dad611;p=mothur.git diff --git a/globaldata.cpp b/globaldata.cpp index 9b740a6..17b4908 100644 --- a/globaldata.cpp +++ b/globaldata.cpp @@ -16,65 +16,22 @@ GlobalData* GlobalData::getInstance() { } /*******************************************************/ -/******************************************************/ - -ListVector* GlobalData::getListVector() { return gListVector; } -/*******************************************************/ - -/******************************************************/ -void GlobalData::setListVector(ListVector* lv){ - try { - if(gListVector != NULL){ delete gListVector; } - gListVector = new ListVector(*lv); - } - catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function setListVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the GlobalData class function setListVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } -} -/*******************************************************/ - -/******************************************************/ - -SparseMatrix* GlobalData::getSparseMatrix() { return gSparseMatrix; } -/*******************************************************/ - -/******************************************************/ -void GlobalData::setSparseMatrix(SparseMatrix* sm){ - try{ - if(gSparseMatrix != NULL){ delete gSparseMatrix; } - gSparseMatrix = new SparseMatrix(*sm); - } - catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function setSparseMatrix. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the GlobalData class function setSparseMatrix. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } -} -/*******************************************************/ - /******************************************************/ //This function parses through the option string of the command to remove its parameters void GlobalData::parseGlobalData(string commandString, string optionText){ try { - allLines = 1; commandName = commandString; //save command name to be used by other classes - //set all non filename paramters to default values + //set all non filename paramters to default reset(); //clears out data from previous read - if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree") || (commandName == "read.shared")) { + if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree")) { clear(); gGroupmap = NULL; gTree.clear(); + labels.clear(); lines.clear(); groups.clear(); + allLines = 1; } //saves help request @@ -107,9 +64,10 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ if (key == "freq" ) { freq = value; } if (key == "method" ) { method = value; } if (key == "fileroot" ) { fileroot = value; } - if (key == "randomtree" ) { randomtree = value; } - if (key == "groups" ) { groups = value; } + if (key == "abund" ) { abund = value; } + if (key == "random" ) { randomtree = value; } if (key == "calc") { calc = value; } + if (key == "line") {//stores lines to be used in a set lines.clear(); @@ -125,11 +83,13 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ splitAtDash(value, labels); allLines = 0; } + if (key == "groups") {//stores groups to be used in a vector Groups.clear(); groups = value; splitAtDash(value, Groups); } + } //saves the last parameter @@ -153,8 +113,8 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ if (key == "freq" ) { freq = value; } if (key == "method" ) { method = value; } if (key == "fileroot" ) { fileroot = value; } - if (key == "randomtree" ) { randomtree = value; } - if (key == "groups" ) { groups = value; } + if (key == "abund" ) { abund = value; } + if (key == "random" ) { randomtree = value; } if (key == "calc") { calc = value; } @@ -162,16 +122,17 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ lines.clear(); line = value; label = ""; - splitAtDash(value, lines); - allLines = 0; + if (line != "all") { splitAtDash(value, lines); allLines = 0; } + else { allLines = 1; } } if (key == "label") {//stores lines to be used in a vector labels.clear(); label = value; line = ""; - splitAtDash(value, labels); - allLines = 0; + if (label != "all") { splitAtDash(value, labels); allLines = 0; } + else { allLines = 1; } } + if (key == "groups") {//stores groups to be used in a vector Groups.clear(); groups = value; @@ -181,6 +142,7 @@ void GlobalData::parseGlobalData(string commandString, string optionText){ //set format for shared if ((listfile != "") && (groupfile != "")) { format = "shared"; } + if ((phylipfile != "") && (groupfile != "")) { format = "matrix"; } //input defaults for calculators if (commandName == "collect.single") { @@ -253,7 +215,9 @@ string GlobalData::getFileRoot() { return fileroot; } string GlobalData::getIters() { return iters; } string GlobalData::getJumble() { return jumble; } string GlobalData::getFreq() { return freq; } +string GlobalData::getAbund() { return abund; } string GlobalData::getRandomTree() { return randomtree; } +string GlobalData::getGroups() { return groups; } void GlobalData::setListFile(string file) { listfile = file; inputFileName = file;} void GlobalData::setRabundFile(string file) { rabundfile = file; inputFileName = file;} void GlobalData::setSabundFile(string file) { sabundfile = file; inputFileName = file;} @@ -262,7 +226,8 @@ void GlobalData::setColumnFile(string file) { columnfile = file; inputFileNam void GlobalData::setNameFile(string file) { namefile = file; } void GlobalData::setFormat(string Format) { format = Format; } void GlobalData::setRandomTree(string Random) { randomtree = Random; } -void GlobalData::setCalc(string Calc) { calc = Calc; } +void GlobalData::setGroups(string g) { groups = g; } +void GlobalData::setCalc(string Calc) { calc = Calc; } /*******************************************************/ @@ -296,27 +261,27 @@ void GlobalData::clear() { label = ""; groups = ""; jumble = "1"; //0 means don't jumble, 1 means jumble. - randomtree = "0"; //0 means user will enter some user trees, 1 means they just want the random tree distribution. + randomtree = ""; //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile. freq = "100"; method = "furthest"; fileroot = ""; - calc = ""; + abund = "10"; } -/*******************************************************/ + +//*******************************************************/ /******************************************************/ void GlobalData::reset() { cutoff = "10.00"; precision = "100"; iters = "1000"; - line = ""; - label = ""; groups = ""; jumble = "1"; //0 means don't jumble, 1 means jumble. - randomtree = "0"; //0 means user will enter some user trees, 1 means they just want the random tree distribution. + randomtree = ""; //"" means user will enter some user trees, "outputfile" means they just want the random tree distribution to be outputted to outputfile. freq = "100"; method = "furthest"; calc = ""; + abund = "10"; } /*******************************************************/ @@ -328,6 +293,3 @@ GlobalData::~GlobalData() { if(gorder != NULL) { delete gorder; } } /*******************************************************/ - -/******************************************************/ -