/***********************************************************************/
InputData::InputData(string fName, string f) : format(f){
-
+ m = MothurOut::getInstance();
openInputFile(fName, fileHandle);
filename = fName;
InputData::InputData(string fName, string orderFileName, string f) : format(f){
try {
-
+ m = MothurOut::getInstance();
ifstream ofHandle;
openInputFile(orderFileName, ofHandle);
string name;
openInputFile(fName, fileHandle);
}
catch(exception& e) {
- errorOut(e, "InputData", "InputData");
+ m->errorOut(e, "InputData", "InputData");
exit(1);
}
}
ListVector* InputData::getListVector(){
try {
- if(fileHandle){
+ if(!fileHandle.eof()){
if(format == "list") {
list = new ListVector(fileHandle);
- }
+ }else{ list = NULL; }
gobble(fileHandle);
return list;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getListVector");
+ m->errorOut(e, "InputData", "getListVector");
exit(1);
}
}
/***********************************************************************/
-
ListVector* InputData::getListVector(string label){
try {
ifstream in;
else { delete list; }
gobble(in);
}
- }
+ }else{ list = NULL; }
in.close();
return list;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getListVector");
+ m->errorOut(e, "InputData", "getListVector");
exit(1);
}
}
+/***********************************************************************/
+ListVector* InputData::getListVector(string label, bool resetFP){
+ try {
+ string thisLabel;
+ fileHandle.clear();
+ fileHandle.seekg(0);
+
+ if(fileHandle){
+ if (format == "list") {
+
+ while (fileHandle.eof() != true) {
+
+ list = new ListVector(fileHandle); gobble(fileHandle);
+ thisLabel = list->getLabel();
+
+ //if you are at the last label
+ if (thisLabel == label) { break; }
+ //so you don't loose this memory
+ else { delete list; }
+ }
+ }else{ list = NULL; }
+
+ return list;
+ }
+ else{
+ return NULL;
+ }
+ }
+ catch(exception& e) {
+ m->errorOut(e, "InputData", "getListVector");
+ exit(1);
+ }
+}
/***********************************************************************/
if(fileHandle){
if (format == "shared") {
SharedList = new SharedListVector(fileHandle);
- }
+ }else{ SharedList = NULL; }
gobble(fileHandle);
return SharedList;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedListVector");
+ m->errorOut(e, "InputData", "getSharedListVector");
exit(1);
}
}
gobble(in);
}
- }
+ }else{ SharedList = NULL; }
in.close();
return SharedList;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedListVector");
+ m->errorOut(e, "InputData", "getSharedListVector");
exit(1);
}
}
if(fileHandle){
if (format == "sharedfile") {
SharedOrder = new SharedOrderVector(fileHandle);
- }
+ }else{ SharedOrder = NULL; }
gobble(fileHandle);
return SharedOrder;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedOrderVector");
+ m->errorOut(e, "InputData", "getSharedOrderVector");
exit(1);
}
}
gobble(in);
}
- }
+ }else{ SharedOrder = NULL; }
in.close();
return SharedOrder;
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedOrderVector");
+ m->errorOut(e, "InputData", "getSharedOrderVector");
exit(1);
}
}
else if(format == "sabund"){
input = new SAbundVector(fileHandle);
}
-
+
gobble(fileHandle);
- output = new OrderVector();
- *output = (input->getOrderVector());
+ output = new OrderVector();
+ *output = (input->getOrderVector());
+
return output;
}
else{
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getOrderVector");
+ m->errorOut(e, "InputData", "getOrderVector");
exit(1);
}
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getOrderVector");
+ m->errorOut(e, "InputData", "getOrderVector");
exit(1);
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedRAbundVectors");
+ m->errorOut(e, "InputData", "getSharedRAbundVectors");
exit(1);
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSharedRAbundVectors");
+ m->errorOut(e, "InputData", "getSharedRAbundVectors");
exit(1);
}
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSAbundVector");
+ m->errorOut(e, "InputData", "getSAbundVector");
exit(1);
}
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getSAbundVector");
+ m->errorOut(e, "InputData", "getSAbundVector");
exit(1);
}
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getRAbundVector");
+ m->errorOut(e, "InputData", "getRAbundVector");
exit(1);
}
}
}
}
catch(exception& e) {
- errorOut(e, "InputData", "getRAbundVector");
+ m->errorOut(e, "InputData", "getRAbundVector");
exit(1);
}
}