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;
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<num;i++){
f >> inputData;
}
}
+ m->gobble(f);
+
if (f.eof() != true) { f >> nextLabel; }
//read the rest of the groups info in
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<num;i++){
f >> inputData;
}
}
+ m->gobble(f);
if (f.eof() != true) { f >> nextLabel; }
//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();
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "SharedOrderVector");
+ m->errorOut(e, "SharedOrderVector", "SharedOrderVector");
exit(1);
}
}
output << endl;
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "print");
+ m->errorOut(e, "SharedOrderVector", "print");
exit(1);
}
}
+/***********************************************************************/
+void SharedOrderVector::clear(){
+ numBins = 0;
+ maxRank = 0;
+ numSeqs = 0;
+ data.clear();
+}
/***********************************************************************/
void SharedOrderVector::resize(int){
- mothurOut("resize() did nothing in class SharedOrderVector");
+ m->mothurOut("resize() did nothing in class SharedOrderVector");
}
/***********************************************************************/
return rav;
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "getRAbundVector");
+ m->errorOut(e, "SharedOrderVector", "getRAbundVector");
exit(1);
}
}
return ov;
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "getOrderVector");
+ m->errorOut(e, "SharedOrderVector", "getOrderVector");
exit(1);
}
}
return sharedRav;
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
+ m->errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
exit(1);
}
}
util = new SharedUtil();
vector<SharedRAbundVector*> 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;
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
+ m->errorOut(e, "SharedOrderVector", "getSharedRAbundVector");
exit(1);
}
}
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "getSharedSAbundVector");
+ m->errorOut(e, "SharedOrderVector", "getSharedSAbundVector");
exit(1);
}
}
}
catch(exception& e) {
- errorOut(e, "SharedOrderVector", "updateStats");
+ m->errorOut(e, "SharedOrderVector", "updateStats");
exit(1);
}
}