5 * Created by Sarah Westcott on 11/18/08.
6 * Copyright 2008 Schloss Lab UMASS Amherst. 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){
38 openInputFile(orderFileName, ofHandle);
45 orderMap[name] = count;
51 openInputFile(fName, fileHandle);
54 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function InputData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
58 cout << "An unknown error has occurred in the InputData class function InputData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
62 /***********************************************************************/
64 ListVector* InputData::getListVector(){
67 if(format == "list") {
68 list = new ListVector(fileHandle);
79 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
83 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
88 /***********************************************************************/
90 SharedListVector* InputData::getSharedListVector(){
93 if (format == "shared") {
94 SharedList = new SharedListVector(fileHandle);
104 catch(exception& e) {
105 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
109 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
114 /***********************************************************************/
116 SharedOrderVector* InputData::getSharedOrderVector(){
119 if (format == "sharedfile") {
120 SharedOrder = new SharedOrderVector(fileHandle);
130 catch(exception& e) {
131 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
135 cout << "An unknown error has occurred in the InputData class function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
142 /***********************************************************************/
144 OrderVector* InputData::getOrderVector(){
147 if(format == "list") {
148 input = new ListVector(fileHandle);
150 else if (format == "shared") {
151 input = new SharedListVector(fileHandle);
153 else if(format == "rabund"){
154 input = new RAbundVector(fileHandle);
156 else if(format == "order"){
157 input = new OrderVector(fileHandle);
159 else if(format == "sabund"){
160 input = new SAbundVector(fileHandle);
162 else if(format == "listorder"){
163 input = new ListVector(fileHandle);
167 output = new OrderVector();
168 *output = (input->getOrderVector());
176 catch(exception& e) {
177 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
181 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
186 /***********************************************************************/
188 SAbundVector* InputData::getSAbundVector(){
191 if (format == "list") {
192 input = new ListVector(fileHandle);
194 else if (format == "shared") {
195 input = new SharedListVector(fileHandle);
197 else if(format == "rabund"){
198 input = new RAbundVector(fileHandle);
200 else if(format == "order"){
201 input = new OrderVector(fileHandle);
203 else if(format == "sabund"){
204 input = new SAbundVector(fileHandle);
209 sabund = new SAbundVector();
210 *sabund = (input->getSAbundVector());
218 catch(exception& e) {
219 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
223 cout << "An unknown error has occurred in the InputData class function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
228 /***********************************************************************/