5 * Created by Sarah Westcott on 1/2/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "rarefactcommand.h"
14 #include "bootstrap.h"
16 #include "npshannon.h"
18 #include "jackknife.h"
20 //**********************************************************************************************************************
23 RareFactCommand::RareFactCommand(){
25 globaldata = GlobalData::getInstance();
27 fileNameRoot = getRootName(globaldata->inputFileName);
29 for (i=0; i<globaldata->rareEstimators.size(); i++) {
30 if (globaldata->rareEstimators[i] == "sobs") {
31 rDisplays.push_back(new RareDisplay(new Sobs(), new ThreeColumnFile(fileNameRoot+"rarefaction")));
32 }else if (globaldata->rareEstimators[i] == "chao") {
33 rDisplays.push_back(new RareDisplay(new Chao1(), new ThreeColumnFile(fileNameRoot+"r_chao")));
34 }else if (globaldata->rareEstimators[i] == "ace") {
35 rDisplays.push_back(new RareDisplay(new Ace(), new ThreeColumnFile(fileNameRoot+"r_ace")));
36 }else if (globaldata->rareEstimators[i] == "jack") {
37 rDisplays.push_back(new RareDisplay(new Jackknife(), new ThreeColumnFile(fileNameRoot+"r_jack")));
38 }else if (globaldata->rareEstimators[i] == "shannon") {
39 rDisplays.push_back(new RareDisplay(new Shannon(), new ThreeColumnFile(fileNameRoot+"r_shannon")));
40 }else if (globaldata->rareEstimators[i] == "npshannon") {
41 rDisplays.push_back(new RareDisplay(new NPShannon(), new ThreeColumnFile(fileNameRoot+"r_npshannon")));
42 }else if (globaldata->rareEstimators[i] == "simpson") {
43 rDisplays.push_back(new RareDisplay(new Simpson(), new ThreeColumnFile(fileNameRoot+"r_simpson")));
44 }else if (globaldata->rareEstimators[i] == "bootstrap") {
45 rDisplays.push_back(new RareDisplay(new Bootstrap(), new ThreeColumnFile(fileNameRoot+"r_bootstrap")));
52 cout << "Standard Error: " << e.what() << " has occurred in the RareFactCommand class Function RareFactCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
56 cout << "An unknown error has occurred in the RareFactCommand class function RareFactCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
62 //**********************************************************************************************************************
64 RareFactCommand::~RareFactCommand(){
71 //**********************************************************************************************************************
73 int RareFactCommand::execute(){
76 read = new ReadPhilFile(globaldata->inputFileName);
77 read->read(&*globaldata);
79 order = globaldata->gorder;
80 input = globaldata->ginput;
84 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
86 rCurve = new Rarefact(order, rDisplays);
87 convert(globaldata->getFreq(), freq);
88 convert(globaldata->getIters(), nIters);
89 rCurve->getCurve(freq, nIters);
93 cout << order->getLabel() << '\t' << count << endl;
96 order = (input->getOrderVector());
101 for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
104 catch(exception& e) {
105 cout << "Standard Error: " << e.what() << " has occurred in the RareFactCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
109 cout << "An unknown error has occurred in the RareFactCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
114 //**********************************************************************************************************************