X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=inputdata.cpp;h=b237bb4fc55b0bacafa3815f9619f0345bd31492;hb=753dc84cf289b1d5dc0ca5b0c043640927aa951a;hp=592367a5fbf0c07f0587a577551654173eb5e15a;hpb=f18d75f9c996cb619a5051a7664620c0c5ae05fb;p=mothur.git diff --git a/inputdata.cpp b/inputdata.cpp index 592367a..b237bb4 100644 --- a/inputdata.cpp +++ b/inputdata.cpp @@ -10,7 +10,7 @@ #include "inputdata.h" #include "ordervector.hpp" #include "listvector.hpp" -#include "utilities.hpp" +#include "rabundvector.hpp" /***********************************************************************/ @@ -24,7 +24,7 @@ InputData::InputData(string fName, string f) : format(f){ InputData::~InputData(){ - + fileHandle.close(); // delete output; } @@ -182,6 +182,40 @@ OrderVector* InputData::getOrderVector(){ exit(1); } } +/***********************************************************************/ +//this is used when you don't need the order vector +vector InputData::getSharedRAbundVectors(){ + try { + if(fileHandle){ + if (format == "sharedfile") { + SharedRAbundVector* SharedRAbund = new SharedRAbundVector(fileHandle); + if (SharedRAbund != NULL) { + return SharedRAbund->getSharedRAbundVectors(); + } + }else if (format == "shared") { + SharedList = new SharedListVector(fileHandle); + if (SharedList != NULL) { + return SharedList->getSharedRAbundVector(); + } + } + gobble(fileHandle); + } + + //this is created to signal to calling function that the input file is at eof + vector null; null.push_back(NULL); + return null; + + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSharedRAbundVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the InputData class function getSharedRAbundVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + /***********************************************************************/ @@ -226,3 +260,46 @@ SAbundVector* InputData::getSAbundVector(){ } /***********************************************************************/ +RAbundVector* InputData::getRAbundVector(){ + try { + if(fileHandle){ + if (format == "list") { + input = new ListVector(fileHandle); + } + else if (format == "shared") { + input = new SharedListVector(fileHandle); + } + else if(format == "rabund"){ + input = new RAbundVector(fileHandle); + } + else if(format == "order"){ + input = new OrderVector(fileHandle); + } + else if(format == "sabund"){ + input = new SAbundVector(fileHandle); + } + + gobble(fileHandle); + + rabund = new RAbundVector(); + *rabund = (input->getRAbundVector()); + + return rabund; + } + else{ + return NULL; + } + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getRAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the InputData class function getRAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} +/***********************************************************************/ + + +