X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sharedrabundfloatvector.cpp;h=9eeb0f21bf3626620806c49372ab36efd0ff0831;hp=b8b91028625cec0cfd1ef59d7dc82ab67b40cde5;hb=cf9987b67aa49777a4c91c2d21f96e58bf17aa82;hpb=ce8794490ab1d83adcdb2b92e0302a1e43e17adf diff --git a/sharedrabundfloatvector.cpp b/sharedrabundfloatvector.cpp index b8b9102..9eeb0f2 100644 --- a/sharedrabundfloatvector.cpp +++ b/sharedrabundfloatvector.cpp @@ -62,13 +62,13 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma //parse labels to save istringstream iStringStream(label); - m->binLabelsInFile.clear(); + m->sharedBinLabelsInFile.clear(); while(!iStringStream.eof()){ if (m->control_pressed) { break; } string temp; iStringStream >> temp; m->gobble(iStringStream); - m->binLabelsInFile.push_back(temp); + m->sharedBinLabelsInFile.push_back(temp); } f >> label >> groupN >> num; @@ -78,7 +78,7 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma //make binlabels because we don't have any string snumBins = toString(num); - m->binLabelsInFile.clear(); + m->sharedBinLabelsInFile.clear(); for (int i = 0; i < num; i++) { //if there is a bin label use it otherwise make one string binLabel = "Otu"; @@ -88,7 +88,7 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma for (int h = 0; h < diff; h++) { binLabel += "0"; } } binLabel += sbinNumber; - m->binLabelsInFile.push_back(binLabel); + m->sharedBinLabelsInFile.push_back(binLabel); } } }else { @@ -99,7 +99,7 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma } //reset labels, currentLabels may have gotten changed as otus were eliminated because of group choices or sampling - m->currentBinLabels = m->binLabelsInFile; + m->currentSharedBinLabels = m->sharedBinLabelsInFile; holdLabel = label; @@ -152,8 +152,6 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma m->saveNextLabel = nextLabel; m->setAllGroups(allGroups); - for (int i = 0; i < allGroups.size(); i++) { cout << allGroups[i] << endl; } - } catch(exception& e) { m->errorOut(e, "SharedRAbundFloatVector", "SharedRAbundFloatVector"); @@ -193,6 +191,16 @@ float SharedRAbundFloatVector::getAbundance(int index){ return data[index].abundance; } /***********************************************************************/ +//returns vector of abundances +vector SharedRAbundFloatVector::getAbundances(){ + vector abunds; + for (int i = 0; i < data.size(); i++) { + abunds.push_back(data[i].abundance); + } + + return abunds; +} +/***********************************************************************/ individualFloat SharedRAbundFloatVector::get(int index){ return data[index]; } @@ -287,7 +295,7 @@ void SharedRAbundFloatVector::printHeaders(ostream& output){ for (int h = 0; h < diff; h++) { binLabel += "0"; } } binLabel += sbinNumber; - if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } + if (i < m->currentSharedBinLabels.size()) { binLabel = m->currentSharedBinLabels[i]; } output << binLabel << '\t'; } @@ -302,7 +310,7 @@ void SharedRAbundFloatVector::printHeaders(ostream& output){ for (int h = 0; h < diff; h++) { binLabel += "0"; } } binLabel += sbinNumber; - if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } + if (i < m->currentSharedBinLabels.size()) { binLabel = m->currentSharedBinLabels[i]; } output << binLabel << '\t'; } @@ -310,7 +318,7 @@ void SharedRAbundFloatVector::printHeaders(ostream& output){ output << endl; } - m->printedHeaders = true; + m->printedSharedHeaders = true; } catch(exception& e) { m->errorOut(e, "SharedRAbundVector", "printHeaders"); @@ -542,7 +550,7 @@ int SharedRAbundFloatVector::eliminateZeroOTUS(vector& for (int h = 0; h < diff; h++) { binLabel += "0"; } } binLabel += sbinNumber; - if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } + if (i < m->currentSharedBinLabels.size()) { binLabel = m->currentSharedBinLabels[i]; } newBinLabels.push_back(binLabel); } @@ -551,7 +559,7 @@ int SharedRAbundFloatVector::eliminateZeroOTUS(vector& for (int j = 0; j < thislookup.size(); j++) { delete thislookup[j]; } thislookup = newLookup; - m->currentBinLabels = newBinLabels; + m->currentSharedBinLabels = newBinLabels; return 0;