X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sharedordervector.cpp;h=37cd28315a5c1928e965f7be8eef7ae0ef408692;hb=c651c46022761aef61644f78462365d8f767ff0b;hp=2df67b8d19b1861714aba2746e3326256cdfe2ae;hpb=74844a60d80c6dd06e3fb02ee9b928424f9019b0;p=mothur.git diff --git a/sharedordervector.cpp b/sharedordervector.cpp index 2df67b8..37cd283 100644 --- a/sharedordervector.cpp +++ b/sharedordervector.cpp @@ -28,10 +28,9 @@ SharedOrderVector::SharedOrderVector(string id, vector ov) : SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a shared file try { - globaldata = GlobalData::getInstance(); maxRank = 0; numBins = 0; numSeqs = 0; - - if (globaldata->gGroupmap == NULL) { groupmap = new GroupMap(); } + + groupmap = new GroupMap(); int num, inputData, count; count = 0; numSeqs = 0; @@ -42,11 +41,11 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a f >> label >> groupN >> num; holdLabel = label; - if (globaldata->gGroupmap == NULL) { - //save group in groupmap - groupmap->namesOfGroups.push_back(groupN); - groupmap->groupIndex[groupN] = 0; - } + + //save group in groupmap + groupmap->namesOfGroups.push_back(groupN); + groupmap->groupIndex[groupN] = 0; + for(int i=0;i> inputData; @@ -57,7 +56,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a } } - gobble(f); + m->gobble(f); if (f.eof() != true) { f >> nextLabel; } @@ -66,11 +65,11 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a f >> groupN >> num; count++; - if (globaldata->gGroupmap == NULL) { - //save group in groupmap - groupmap->namesOfGroups.push_back(groupN); - groupmap->groupIndex[groupN] = count; - } + + //save group in groupmap + groupmap->namesOfGroups.push_back(groupN); + groupmap->groupIndex[groupN] = count; + for(int i=0;i> inputData; @@ -81,7 +80,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a } } - gobble(f); + m->gobble(f); if (f.eof() != true) { f >> nextLabel; } @@ -90,7 +89,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() { //reads in a //put file pointer back since you are now at a new distance label for (int i = 0; i < nextLabel.length(); i++) { f.unget(); } - if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; } + m->namesOfGroups = groupmap->namesOfGroups; updateStats(); @@ -171,7 +170,14 @@ void SharedOrderVector::print(ostream& output){ } } +/***********************************************************************/ +void SharedOrderVector::clear(){ + numBins = 0; + maxRank = 0; + numSeqs = 0; + data.clear(); +} /***********************************************************************/ void SharedOrderVector::resize(int){ @@ -279,8 +285,8 @@ vector SharedOrderVector::getSharedRAbundVector() { util = new SharedUtil(); vector lookup; - util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups); - util->getSharedVectors(globaldata->Groups, lookup, this); + util->setGroups(m->Groups, m->namesOfGroups); + util->getSharedVectors(m->Groups, lookup, this); return lookup; }