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";
114 /***********************************************************************/
116 OrderVector* InputData::getOrderVector(){
119 if(format == "list") {
120 input = new ListVector(fileHandle);
122 else if(format == "shared") {
123 input = new SharedListVector(fileHandle);
125 else if(format == "rabund"){
126 input = new RAbundVector(fileHandle);
128 else if(format == "order"){
129 input = new OrderVector(fileHandle);
131 else if(format == "sabund"){
132 input = new SAbundVector(fileHandle);
134 else if(format == "listorder"){
135 input = new ListVector(fileHandle);
139 output = new OrderVector();
140 *output = (input->getOrderVector());
148 catch(exception& e) {
149 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
153 cout << "An unknown error has occurred in the InputData class function getOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
158 /***********************************************************************/
160 SAbundVector* InputData::getSAbundVector(){
163 if (format == "list") {
164 input = new ListVector(fileHandle);
166 else if(format == "shared") {
167 input = new SharedListVector(fileHandle);
169 else if(format == "rabund"){
170 input = new RAbundVector(fileHandle);
172 else if(format == "order"){
173 input = new OrderVector(fileHandle);
175 else if(format == "sabund"){
176 input = new SAbundVector(fileHandle);
181 sabund = new SAbundVector();
182 *sabund = (input->getSAbundVector());
190 catch(exception& e) {
191 cout << "Standard Error: " << e.what() << " has occurred in the InputData class Function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
195 cout << "An unknown error has occurred in the InputData class function getSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
200 /***********************************************************************/