X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readotu.cpp;h=d16dab9477d4c02ce89ad42de0be4c46228588b4;hb=c53c53b0280452e1c3a087fbf807b2e508cd66c4;hp=286a2be271a4a7bb2225a71c7081b1a5c8eb4571;hpb=753dc84cf289b1d5dc0ca5b0c043640927aa951a;p=mothur.git diff --git a/readotu.cpp b/readotu.cpp index 286a2be..d16dab9 100644 --- a/readotu.cpp +++ b/readotu.cpp @@ -13,7 +13,7 @@ ReadOTUFile::ReadOTUFile(string pf): philFile(pf){ - openInputFile(philFile, fileHandle); + //openInputFile(philFile, fileHandle); } /***********************************************************************/ @@ -31,11 +31,11 @@ void ReadOTUFile::read(GlobalData* globaldata){ }else {//there is an orderfile input = new InputData(philFile, globaldata->getOrderFile(), globaldata->getFormat()); } -//cout << "made it here" << endl; + //memory leak prevention //if (globaldata->ginput != NULL) { delete globaldata->ginput; } globaldata->ginput = input; //saving to be used by collector and rarefact commands. -//cout << "after input" << endl; + if ((globaldata->getFormat() == "list") || (globaldata->getFormat() == "rabund") || (globaldata->getFormat() == "sabund")) {//you are reading a list, rabund or sabund file for collect, rarefaction or summary. order = input->getOrderVector(); //memory leak prevention @@ -44,12 +44,15 @@ void ReadOTUFile::read(GlobalData* globaldata){ sabund = inputSabund->getSAbundVector(); //if (globaldata->sabund != NULL) { delete globaldata->sabund; } globaldata->sabund = sabund; //saving to be used by summary command. + delete inputSabund; rabund = inputRabund->getRAbundVector(); //if (globaldata->rabund != NULL) { delete globaldata->rabund; } globaldata->rabund = rabund; //saving to be used by heatmap.bin command. + delete inputRabund; list = inputList->getListVector(); //if (globaldata->gListVector != NULL) { delete globaldata->gListVector; } globaldata->gListVector = list; + delete inputList; }else if (globaldata->getFormat() == "shared") { SharedList = input->getSharedListVector(); //you are reading for collect.shared, rarefaction.shared, summary.shared, parselist command, or shared commands. @@ -59,11 +62,7 @@ void ReadOTUFile::read(GlobalData* globaldata){ } } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the ReadOTUFile class Function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the ReadOTUFile class function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + errorOut(e, "ReadOTUFile", "read"); exit(1); } }