5 * Created by Sarah Westcott on 4/21/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
12 /***********************************************************************/
14 ReadOTUFile::ReadOTUFile(string pf): philFile(pf){
16 openInputFile(philFile, fileHandle);
19 /***********************************************************************/
20 //This function reads the list, rabund or sabund files to be used by collect and rarefact command.
21 void ReadOTUFile::read(GlobalData* globaldata){
23 if (globaldata->getOrderFile() == "") {
24 //you have two inputs because in the next if statement if you only have one then it moves ahead in the same file.
25 //So when you run the collect or summary commands you miss a line.
26 input = new InputData(philFile, globaldata->getFormat()); //format tells you whether philFile is list, rabund, sabund.
27 inputList = new InputData(philFile, globaldata->getFormat()); //format tells you whether philFile is list, rabund, sabund.
28 inputSabund = new InputData(philFile, globaldata->getFormat()); //format tells you whether philFile is list, rabund, sabund or shared.
29 inputRabund = new InputData(philFile, globaldata->getFormat());
30 }else {//there is an orderfile
31 input = new InputData(philFile, globaldata->getOrderFile(), globaldata->getFormat());
34 //memory leak prevention
35 //if (globaldata->ginput != NULL) { delete globaldata->ginput; }
36 globaldata->ginput = input; //saving to be used by collector and rarefact commands.
38 if ((globaldata->getFormat() == "list") || (globaldata->getFormat() == "rabund") || (globaldata->getFormat() == "sabund")) {//you are reading a list, rabund or sabund file for collect, rarefaction or summary.
39 order = input->getOrderVector();
40 //memory leak prevention
41 //if (globaldata->gorder != NULL) { delete globaldata->gorder; }
42 globaldata->gorder = order; //saving to be used by collect and rarefact commands.
43 sabund = inputSabund->getSAbundVector();
44 globaldata->sabund = sabund; //saving to be used by summary command.
45 rabund = inputRabund->getRAbundVector();
46 globaldata->rabund = rabund; //saving to be used by heatmap command.
47 list = inputList->getListVector();
48 globaldata->gListVector = list;
49 }else if (globaldata->getFormat() == "shared") {
50 SharedList = input->getSharedListVector(); //you are reading for collect.shared, rarefaction.shared, summary.shared, parselist command, or shared commands.
51 //memory leak prevention
52 //if (globaldata->gSharedList != NULL) { delete globaldata->gSharedList; }
53 globaldata->gSharedList = SharedList;
57 cout << "Standard Error: " << e.what() << " has occurred in the ReadOTUFile class Function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
61 cout << "An unknown error has occurred in the ReadOTUFile class function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
66 /***********************************************************************/
68 ReadOTUFile::~ReadOTUFile(){
73 /***********************************************************************/