X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=inputdata.cpp;h=5d1542739b0b0b6d6e730a5e84654468e3ca819f;hb=e99751591aa21705e58edda87383457b9738dd9e;hp=a4d66921629cc700f2042d676f9e52e50674ba56;hpb=7ae40733a270f73ec8a331540cc7f28fd60b24fc;p=mothur.git diff --git a/inputdata.cpp b/inputdata.cpp index a4d6692..5d15427 100644 --- a/inputdata.cpp +++ b/inputdata.cpp @@ -16,6 +16,7 @@ InputData::InputData(string fName, string f) : format(f){ m = MothurOut::getInstance(); + globaldata = GlobalData::getInstance(); m->openInputFile(fName, fileHandle); filename = fName; @@ -26,6 +27,8 @@ InputData::InputData(string fName, string f) : format(f){ InputData::~InputData(){ fileHandle.close(); + globaldata = GlobalData::getInstance(); + globaldata->saveNextLabel = ""; // delete output; } @@ -35,6 +38,7 @@ InputData::~InputData(){ InputData::InputData(string fName, string orderFileName, string f) : format(f){ try { m = MothurOut::getInstance(); + globaldata = GlobalData::getInstance(); ifstream ofHandle; m->openInputFile(orderFileName, ofHandle); string name; @@ -451,7 +455,8 @@ vector InputData::getSharedRAbundVectors(string label){ string thisLabel; m->openInputFile(filename, in); - + globaldata->saveNextLabel = ""; + if(in){ if (format == "sharedfile") { while (in.eof() != true) { @@ -459,6 +464,7 @@ vector InputData::getSharedRAbundVectors(string label){ SharedRAbundVector* SharedRAbund = new SharedRAbundVector(in); if (SharedRAbund != NULL) { thisLabel = SharedRAbund->getLabel(); + //if you are at the last label if (thisLabel == label) { in.close(); return SharedRAbund->getSharedRAbundVectors(); } else { @@ -534,9 +540,10 @@ vector InputData::getSharedRAbundFloatVectors(string l string thisLabel; m->openInputFile(filename, in); + globaldata->saveNextLabel = ""; if(in){ - if (format == "sharedfile") { + if (format == "relabund") { while (in.eof() != true) { SharedRAbundFloatVector* SharedRelAbund = new SharedRAbundFloatVector(in);