X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=inputdata.cpp;h=8b1829a3db697df21b3d0f64bf6be6cfea15c536;hp=283fb7edc33856613612e10b0d293d0eea1f056d;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=37eac2026d91179acda0494c4dcca22f176551b9 diff --git a/inputdata.cpp b/inputdata.cpp index 283fb7e..8b1829a 100644 --- a/inputdata.cpp +++ b/inputdata.cpp @@ -16,21 +16,15 @@ InputData::InputData(string fName, string f) : format(f){ m = MothurOut::getInstance(); - globaldata = GlobalData::getInstance(); m->openInputFile(fName, fileHandle); filename = fName; - + m->saveNextLabel = ""; } - /***********************************************************************/ - InputData::~InputData(){ fileHandle.close(); - globaldata = GlobalData::getInstance(); - globaldata->saveNextLabel = ""; -// delete output; - + m->saveNextLabel = ""; } /***********************************************************************/ @@ -38,7 +32,6 @@ 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; @@ -54,6 +47,8 @@ InputData::InputData(string fName, string orderFileName, string f) : format(f){ ofHandle.close(); m->openInputFile(fName, fileHandle); + m->saveNextLabel = ""; + } catch(exception& e) { m->errorOut(e, "InputData", "InputData"); @@ -298,7 +293,7 @@ OrderVector* InputData::getOrderVector(){ else if(format == "sabund"){ input = new SAbundVector(fileHandle); } - + m->gobble(fileHandle); output = new OrderVector(); @@ -400,7 +395,7 @@ OrderVector* InputData::getOrderVector(string label){ } } - + in.close(); output = new OrderVector(); @@ -431,6 +426,7 @@ vector InputData::getSharedRAbundVectors(){ } }else if (format == "shared") { SharedList = new SharedListVector(fileHandle); + if (SharedList != NULL) { return SharedList->getSharedRAbundVector(); } @@ -455,7 +451,7 @@ vector InputData::getSharedRAbundVectors(string label){ string thisLabel; m->openInputFile(filename, in); - globaldata->saveNextLabel = ""; + m->saveNextLabel = ""; if(in){ if (format == "sharedfile") { @@ -481,6 +477,7 @@ vector InputData::getSharedRAbundVectors(string label){ while (in.eof() != true) { SharedList = new SharedListVector(in); + if (SharedList != NULL) { thisLabel = SharedList->getLabel(); //if you are at the last label @@ -549,7 +546,7 @@ vector InputData::getSharedRAbundFloatVectors(string l string thisLabel; m->openInputFile(filename, in); - globaldata->saveNextLabel = ""; + m->saveNextLabel = ""; if(in){ if (format == "relabund") { @@ -626,8 +623,7 @@ SAbundVector* InputData::getSAbundVector(){ } else if(format == "sabund"){ input = new SAbundVector(fileHandle); - } - + } m->gobble(fileHandle); sabund = new SAbundVector(); @@ -766,7 +762,7 @@ RAbundVector* InputData::getRAbundVector(){ else if(format == "sabund"){ input = new SAbundVector(fileHandle); } - + m->gobble(fileHandle); rabund = new RAbundVector(); @@ -866,7 +862,8 @@ RAbundVector* InputData::getRAbundVector(string label){ } - } + } + in.close();