5 * Created by Sarah Westcott on 11/18/08.
6 * Copyright 2008 __MyCompanyName__. All rights reserved.
10 #include "inputdata.h"
11 #include "ordervector.hpp"
12 #include "listvector.hpp"
13 #include "utilities.hpp"
15 /***********************************************************************/
17 InputData::InputData(string fName, string f) : format(f){
19 openInputFile(fName, fileHandle);
23 /***********************************************************************/
26 InputData::~InputData(){
32 /***********************************************************************/
34 InputData::InputData(string fName, string orderFileName, string f) : format(f){
37 openInputFile(orderFileName, ofHandle);
44 orderMap[name] = count;
50 openInputFile(fName, fileHandle);
53 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function InputData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
57 cout << "An unknown error has occurred in the InputData class function InputData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
61 /***********************************************************************/
63 ListVector* InputData::getListVector(){
66 if((format == "list") || (format == "shared")){
67 list = new ListVector(fileHandle);
78 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
82 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
89 /***********************************************************************/
91 OrderVector* InputData::getOrderVector(){
94 if((format == "list") || (format == "shared")){
95 input = new ListVector(fileHandle);
97 else if(format == "rabund"){
98 input = new RAbundVector(fileHandle);
100 else if(format == "order"){
101 input = new OrderVector(fileHandle);
103 else if(format == "sabund"){
104 input = new SAbundVector(fileHandle);
106 else if(format == "listorder"){
107 input = new ListVector(fileHandle);
111 output = new OrderVector();
112 *output = (input->getOrderVector());
120 catch(exception& e) {
121 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
125 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
130 /***********************************************************************/
132 SAbundVector* InputData::getSAbundVector(){
135 if((format == "list") || (format == "shared")){
136 input = new ListVector(fileHandle);
138 else if(format == "rabund"){
139 input = new RAbundVector(fileHandle);
141 else if(format == "order"){
142 input = new OrderVector(fileHandle);
144 else if(format == "sabund"){
145 input = new SAbundVector(fileHandle);
150 sabund = new SAbundVector();
151 *sabund = (input->getSAbundVector());
159 catch(exception& e) {
160 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
164 cout << "An unknown error has occurred in the InputData class function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
169 /***********************************************************************/