From fe342304a0fdff3ab48226e1dcfdab95d3a94a64 Mon Sep 17 00:00:00 2001 From: westcott Date: Tue, 21 Apr 2009 15:14:13 +0000 Subject: [PATCH] fixed bug with get.oturep and fixed problem with errorcheckor that did not allow the user to read a phylip and then a column. --- errorchecking.cpp | 32 +++++++++++++++----------------- getoturepcommand.cpp | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/errorchecking.cpp b/errorchecking.cpp index 4eef3b0..aa223a2 100644 --- a/errorchecking.cpp +++ b/errorchecking.cpp @@ -23,21 +23,21 @@ ErrorCheck::ErrorCheck() { /******************************************************/ void ErrorCheck::refresh() { - columnfile = globaldata->getColumnFile(); - phylipfile = globaldata->getPhylipFile(); - listfile = globaldata->getListFile(); - rabundfile = globaldata->getRabundFile(); - sabundfile = globaldata->getSabundFile(); - namefile = globaldata->getNameFile(); - groupfile = globaldata->getGroupFile(); - orderfile = globaldata->getOrderFile(); - fastafile = globaldata->getFastaFile(); - treefile = globaldata->getTreeFile(); - cutoff = globaldata->getCutOff(); - format = globaldata->getFormat(); - method = globaldata->getMethod(); - randomtree = globaldata->getRandomTree(); - sharedfile = globaldata->getSharedFile(); + //columnfile = globaldata->getColumnFile(); + //phylipfile = globaldata->getPhylipFile(); + //listfile = globaldata->getListFile(); + //rabundfile = globaldata->getRabundFile(); + //sabundfile = globaldata->getSabundFile(); + //namefile = globaldata->getNameFile(); + //groupfile = globaldata->getGroupFile(); + //orderfile = globaldata->getOrderFile(); + //fastafile = globaldata->getFastaFile(); + //treefile = globaldata->getTreeFile(); + //cutoff = globaldata->getCutOff(); + //format = globaldata->getFormat(); + //method = globaldata->getMethod(); + //randomtree = globaldata->getRandomTree(); + //sharedfile = globaldata->getSharedFile(); } /*******************************************************/ @@ -85,8 +85,6 @@ bool ErrorCheck::checkInput(string input) { //is it a valid parameter if (validParameter->isValidParameter(parameter, commandName, value) != true) { return false; } - - if (parameter == "phylip" ) { phylipfile = value; } if (parameter == "column" ) { columnfile = value; } diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index 064455f..6daad97 100644 --- a/getoturepcommand.cpp +++ b/getoturepcommand.cpp @@ -20,11 +20,19 @@ GetOTURepCommand::GetOTURepCommand(){ if(globaldata->gListVector != NULL) { listOfNames = new ListVector(*globaldata->gListVector); + vector names; + string binnames; //map names to rows in sparsematrix for (int i = 0; i < listOfNames->size(); i++) { - nameToIndex[listOfNames->get(i)] = i; + names.clear(); + binnames = listOfNames->get(i); + splitAtComma(binnames, names); + + for (int j = 0; j < names.size(); j++) { + nameToIndex[names[j]] = i; + } } - }else { cout << "error" << endl; } + }else { cout << "error, no listvector." << endl; } fastafile = globaldata->getFastaFile(); @@ -176,7 +184,7 @@ string GetOTURepCommand::FindRep(int bin) { string minName; binnames = list->get(bin); - + //parse names into vector splitAtComma(binnames, names); @@ -186,6 +194,7 @@ string GetOTURepCommand::FindRep(int bin) { //fill binMap for (int i = 0; i < names.size(); i++) { for (it3 = nameToIndex.begin(); it3 != nameToIndex.end(); it3++) { + if (it3->first == names[i]) { binMap[it3->second] = it3->first; -- 2.39.2