*
*/
-
-using namespace std;
-
#include "sharedrabundvector.h"
#include "sabundvector.hpp"
#include "ordervector.hpp"
/***********************************************************************/
-SharedRAbundVector::SharedRAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0) {};
+SharedRAbundVector::SharedRAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0) {globaldata = GlobalData::getInstance();}
/***********************************************************************/
SharedRAbundVector::SharedRAbundVector(int n) : DataVector(), maxRank(0), numBins(n), numSeqs(0) {
+ globaldata = GlobalData::getInstance();
individual newGuy;
//initialize data
for (int i=0; i< n; i++) {
newGuy.abundance = 0;
data.push_back(newGuy);
}
-};
+}
/***********************************************************************
if (globaldata->gGroupmap == NULL) { groupmap = new GroupMap(); }
- int num, inputData, pos, count;
+ int num, inputData, count;
count = 0;
string holdLabel, nextLabel, groupN;
individual newguy;
holdLabel = label;
//add new vector to lookup
- lookup.push_back(new SharedRAbundVector());
+ SharedRAbundVector* temp = new SharedRAbundVector();
+ lookup.push_back(temp);
lookup[0]->setLabel(label);
lookup[0]->setGroup(groupN);
}
- //save position in file in case next line is a new label.
- pos = f.tellg();
-
if (f.eof() != true) { f >> nextLabel; }
//read the rest of the groups info in
}
//add new vector to lookup
- lookup.push_back(new SharedRAbundVector());
+ temp = new SharedRAbundVector();
+ lookup.push_back(temp);
lookup[count]->setLabel(label);
lookup[count]->setGroup(groupN);
lookup[count]->push_back(inputData, i, groupN); //abundance, bin, group
}
- //save position in file in case next line is a new label.
- pos = f.tellg();
-
+
if (f.eof() != true) { f >> nextLabel; }
}
//put file pointer back since you are now at a new distance label
- f.seekg(pos, ios::beg);
+ for (int i = 0; i < nextLabel.length(); i++) { f.unget(); }
- if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
+ if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
}
catch(exception& e) {
/***********************************************************************/
-SharedRAbundVector::~SharedRAbundVector() {
-
-}
-
-/***********************************************************************/
-
void SharedRAbundVector::set(int binNumber, int newBinSize, string groupname){
try {
int oldBinSize = data[binNumber].abundance;
i--;
}
}
-
+
+ delete util;
+
return lookup;
}
catch(exception& e) {
random_shuffle(ov.begin(), ov.end());
ov.setLabel(label);
+ ov.updateStats();
+
return ov;
}
catch(exception& e) {