-/******************************************************/
-
-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
-
- //clears out data from previous read
- if ((commandName == "read.dist") || (commandName == "read.otu") || (commandName == "read.tree")) {
- clear();
- }
-
- //saves help request
- if (commandName =="help") {
- helpRequest = optionText;
- }
-
- string key, value;
- //reads in parameters and values
- if((optionText != "") && (commandName != "help")){
- while((optionText.find_first_of(',') != -1)) { //while there are parameters
- splitAtComma(value, optionText);
- splitAtEquals(key, value);
-
- if (key == "phylip" ) { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip"; }
- if (key == "column" ) { columnfile = value; inputFileName = value; fileroot = value; format = "column"; }
- if (key == "list" ) { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
- if (key == "rabund" ) { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
- if (key == "sabund" ) { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
- if (key == "fasta" ) { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; }
- if (key == "treefile" ) { treefile = value; inputFileName = value; fileroot = value; format = "tree"; }
- if (key == "name" ) { namefile = value; }
- if (key == "order" ) { orderfile = value; }
- if (key == "group" ) { groupfile = value; }
- if (key == "cutoff" ) { cutoff = value; }
- if (key == "precision" ) { precision = value; }
- if (key == "iters" ) { iters = value; }
- if (key == "jumble" ) { jumble = value; }
- if (key == "freq" ) { freq = value; }
- if (key == "method" ) { method = value; }
- if (key == "fileroot" ) { fileroot = value; }
-
- if (key == "single") {//stores estimators in a vector
- singleEstimators.clear(); //clears out old values
- if (value == "default") { value = "sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson-rarefraction"; }
- splitAtDash(value, singleEstimators);
- }
- if (key == "rarefaction") {//stores estimators in a vector
- rareEstimators.clear(); //clears out old values
- if (value == "default") { value = "rarefraction"; }
- splitAtDash(value, rareEstimators);
- }
- if (key == "shared") {//stores estimators in a vector
- sharedEstimators.clear(); //clears out old values
- if (value == "default") { value = "sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN"; }
- splitAtDash(value, sharedEstimators);
- }
- if (key == "summary") { //stores summaries to be used in a vector
- summaryEstimators.clear();
- if (value == "default") { value = "summary-chao-ace-jack-bootstrap-shannon-npshannon-simpson"; }
- splitAtDash(value, summaryEstimators);
- }
- if (key == "sharedsummary") { //stores sharedSummaries to be used in a vector
- sharedSummaryEstimators.clear();
- if (value == "default") { value = "sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN"; }
- splitAtDash(value, sharedSummaryEstimators);
- }
- if (key == "sharedrarefaction") { //stores sharedrarefaction to be used in a vector
- sharedRareEstimators.clear();
- if (value == "default") { value = "sharedobserved"; }
- splitAtDash(value, sharedRareEstimators);
- }
- if (key == "line") {//stores lines to be used in a vector
- lines.clear();
- line = value;
- splitAtDash(value, lines);
- allLines = 0;
- }
- if (key == "label") {//stores lines to be used in a vector
- labels.clear();
- label = value;
- splitAtDash(value, labels);
- allLines = 0;
- }
- }
-
- //saves the last parameter
- value = optionText;
- splitAtEquals(key, value);
- if (key == "phylip" ) { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip"; }
- if (key == "column" ) { columnfile = value; inputFileName = value; fileroot = value; format = "column"; }
- if (key == "list" ) { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
- if (key == "rabund" ) { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
- if (key == "sabund" ) { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
- if (key == "fasta" ) { fastafile = value; inputFileName = value; fileroot = value; format = "fasta"; }
- if (key == "treefile" ) { treefile = value; inputFileName = value; fileroot = value; format = "tree"; }
- if (key == "name" ) { namefile = value; }
- if (key == "order" ) { orderfile = value; }
- if (key == "group" ) { groupfile = value; }
- if (key == "cutoff" ) { cutoff = value; }
- if (key == "precision" ) { precision = value; }
- if (key == "iters" ) { iters = value; }
- if (key == "jumble" ) { jumble = value; }
- if (key == "freq" ) { freq = value; }
- if (key == "method" ) { method = value; }
- if (key == "fileroot" ) { fileroot = value; }
-
- if (key == "single") {//stores estimators in a vector
- singleEstimators.clear(); //clears out old values
- if (value == "default") { value = "sobs-chao-ace-jack-bootstrap-shannon-npshannon-simpson-rarefraction"; }
- splitAtDash(value, singleEstimators);
- }
- if (key == "rarefaction") {//stores estimators in a vector
- rareEstimators.clear(); //clears out old values
- if (value == "default") { value = "rarefraction"; }
- splitAtDash(value, rareEstimators);
- }
- if (key == "shared") {//stores estimators in a vector
- sharedEstimators.clear(); //clears out old values
- if (value == "default") { value = "sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN"; }
- splitAtDash(value, sharedEstimators);
- }
- if (key == "summary") { //stores summaries to be used in a vector
- summaryEstimators.clear();
- if (value == "default") { value = "summary-chao-ace-jack-bootstrap-shannon-npshannon-simpson"; }
- splitAtDash(value, summaryEstimators);
- }
- if (key == "sharedsummary") { //stores sharedSummaries to be used in a vector
- sharedSummaryEstimators.clear();
- if (value == "default") { value = "sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN"; }
- splitAtDash(value, sharedSummaryEstimators);
- }
- if (key == "sharedrarefaction") { //stores sharedrarefaction to be used in a vector
- sharedRareEstimators.clear();
- if (value == "default") { value = "sharedobserved"; }
- splitAtDash(value, sharedRareEstimators);
- }
-
- if (key == "line") {//stores lines to be used in a vector
- lines.clear();
- line = value;
- splitAtDash(value, lines);
- allLines = 0;
- }
- if (key == "label") {//stores lines to be used in a vector
- labels.clear();
- label = value;
- splitAtDash(value, labels);
- allLines = 0;
- }
- }
-
- //set format for shared
- if ((listfile != "") && (groupfile != "")) { format = "shared"; }
-
- //input defaults
- if (commandName == "collect.single") {
- if (singleEstimators.size() == 0) { splitAtDash(single, singleEstimators); }
- }
- if (commandName == "rarefaction.single") {
- if (rareEstimators.size() == 0) { splitAtDash(rarefaction, rareEstimators); }
- }
- if (commandName == "collect.shared") {
- if (sharedEstimators.size() == 0) { splitAtDash(shared, sharedEstimators); }
- }
- if (commandName == "summary.single") {
- if (summaryEstimators.size() == 0) { splitAtDash(summary, summaryEstimators); }
- }
- if (commandName == "summary.shared") {
- if (sharedSummaryEstimators.size() == 0) { splitAtDash(sharedsummary, sharedSummaryEstimators); }
- }
- if (commandName == "rarefaction.shared") {
- if (sharedRareEstimators.size() == 0) { splitAtDash(sharedrarefaction, sharedRareEstimators); }
- }
-
-
- //if you have done a read.otu with a groupfile but don't want to use it anymore because you want to do single commands
- if ((commandName == "collect.single") || (commandName == "rarefaction.single") || (commandName == "summary.single")) {
- if (listfile != "") { format = "list"; }
- else if (sabundfile != "") { format = "sabund"; }
- else if (rabundfile != "") { format = "rabund"; }
- }
-
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the GlobalData class Function parseGlobalData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the GlobalData class function parseGlobalData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-
-}
-/*******************************************************/
-