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){
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") {
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";
87 /***********************************************************************/
89 SharedListVector* InputData::getSharedListVector(){
92 if (format == "shared") {
93 SharedList = new SharedListVector(fileHandle);
103 catch(exception& e) {
104 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
108 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
113 /***********************************************************************/
115 SharedOrderVector* InputData::getSharedOrderVector(){
118 if (format == "sharedfile") {
119 SharedOrder = new SharedOrderVector(fileHandle);
129 catch(exception& e) {
130 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
134 cout << "An unknown error has occurred in the InputData class function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
141 /***********************************************************************/
143 OrderVector* InputData::getOrderVector(){
146 if(format == "list") {
147 input = new ListVector(fileHandle);
149 else if (format == "shared") {
150 input = new SharedListVector(fileHandle);
152 else if(format == "rabund"){
153 input = new RAbundVector(fileHandle);
155 else if(format == "order"){
156 input = new OrderVector(fileHandle);
158 else if(format == "sabund"){
159 input = new SAbundVector(fileHandle);
161 else if(format == "listorder"){
162 input = new ListVector(fileHandle);
166 output = new OrderVector();
167 *output = (input->getOrderVector());
175 catch(exception& e) {
176 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
180 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
185 /***********************************************************************/
187 SAbundVector* InputData::getSAbundVector(){
190 if (format == "list") {
191 input = new ListVector(fileHandle);
193 else if (format == "shared") {
194 input = new SharedListVector(fileHandle);
196 else if(format == "rabund"){
197 input = new RAbundVector(fileHandle);
199 else if(format == "order"){
200 input = new OrderVector(fileHandle);
202 else if(format == "sabund"){
203 input = new SAbundVector(fileHandle);
208 sabund = new SAbundVector();
209 *sabund = (input->getSAbundVector());
217 catch(exception& e) {
218 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
222 cout << "An unknown error has occurred in the InputData class function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
227 /***********************************************************************/