5 * Created by Sarah Westcott on 1/2/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "collectcommand.h"
14 #include "bootstrap.h"
16 #include "npshannon.h"
18 #include "jackknife.h"
21 //**********************************************************************************************************************
24 CollectCommand::CollectCommand(){
26 globaldata = GlobalData::getInstance();
28 fileNameRoot = getRootName(globaldata->inputFileName);
30 for (i=0; i<globaldata->singleEstimators.size(); i++) {
31 if (globaldata->singleEstimators[i] == "sobs") {
32 cDisplays.push_back(new CollectDisplay(new Sobs(), new OneColumnFile(fileNameRoot+"sobs")));
33 }else if (globaldata->singleEstimators[i] == "chao") {
34 cDisplays.push_back(new CollectDisplay(new Chao1(), new ThreeColumnFile(fileNameRoot+"chao")));
35 }else if (globaldata->singleEstimators[i] == "ace") {
36 cDisplays.push_back(new CollectDisplay(new Ace(), new ThreeColumnFile(fileNameRoot+"ace")));
37 }else if (globaldata->singleEstimators[i] == "jack") {
38 cDisplays.push_back(new CollectDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"jack")));
39 }else if (globaldata->singleEstimators[i] == "shannon") {
40 cDisplays.push_back(new CollectDisplay(new Shannon(), new ThreeColumnFile(fileNameRoot+"shannon")));
41 }else if (globaldata->singleEstimators[i] == "npshannon") {
42 cDisplays.push_back(new CollectDisplay(new NPShannon(), new OneColumnFile(fileNameRoot+"np_shannon")));
43 }else if (globaldata->singleEstimators[i] == "simpson") {
44 cDisplays.push_back(new CollectDisplay(new Simpson(), new ThreeColumnFile(fileNameRoot+"simpson")));
45 }else if (globaldata->singleEstimators[i] == "bootstrap") {
46 cDisplays.push_back(new CollectDisplay(new Bootstrap(), new OneColumnFile(fileNameRoot+"bootstrap")));
51 cout << "Standard Error: " << e.what() << " has occurred in the CollectCommand class Function CollectCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
55 cout << "An unknown error has occurred in the CollectCommand class function CollectCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
61 //**********************************************************************************************************************
63 CollectCommand::~CollectCommand(){
70 //**********************************************************************************************************************
72 int CollectCommand::execute(){
75 read = new ReadPhilFile(globaldata->inputFileName);
76 read->read(&*globaldata);
78 order = globaldata->gorder;
79 input = globaldata->ginput;
83 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
85 cCurve = new Collect(order, cDisplays);
86 convert(globaldata->getFreq(), freq);
87 cCurve->getCurve(freq);
91 cout << order->getLabel() << '\t' << count << endl;
94 order = (input->getOrderVector());
99 for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
102 catch(exception& e) {
103 cout << "Standard Error: " << e.what() << " has occurred in the CollectCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
107 cout << "An unknown error has occurred in the CollectCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
112 //**********************************************************************************************************************