2 * collectsharedcommand.cpp
5 * Created by Sarah Westcott on 1/2/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "collectsharedcommand.h"
11 #include "sharedchao1.h"
12 #include "sharedace.h"
13 #include "sharedjabund.h"
14 #include "sharedsorabund.h"
15 #include "sharedjclass.h"
16 #include "sharedsorclass.h"
17 #include "sharedjest.h"
18 #include "sharedsorest.h"
19 #include "sharedthetayc.h"
20 #include "sharedthetan.h"
23 //**********************************************************************************************************************
25 CollectSharedCommand::CollectSharedCommand(){
27 globaldata = GlobalData::getInstance();
29 fileNameRoot = getRootName(globaldata->inputFileName);
30 groupmap = globaldata->gGroupmap;
33 for (i=0; i<globaldata->sharedEstimators.size(); i++) {
34 if (globaldata->sharedEstimators[i] == "sharedChao") {
35 cDisplays.push_back(new CollectDisplay(new SharedChao1(), new SharedOneColumnFile(fileNameRoot+"sharedChao", groupmap->namesOfGroups)));
36 }else if (globaldata->sharedEstimators[i] == "sharedAce") {
37 cDisplays.push_back(new CollectDisplay(new SharedAce(), new SharedOneColumnFile(fileNameRoot+"sharedAce", groupmap->namesOfGroups)));
38 }else if (globaldata->sharedEstimators[i] == "sharedJabund") {
39 cDisplays.push_back(new CollectDisplay(new SharedJAbund(), new SharedOneColumnFile(fileNameRoot+"SharedJabund", groupmap->namesOfGroups)));
40 }else if (globaldata->sharedEstimators[i] == "sharedSorensonAbund") {
41 cDisplays.push_back(new CollectDisplay(new SharedSorAbund(), new SharedOneColumnFile(fileNameRoot+"SharedSorensonAbund", groupmap->namesOfGroups)));
42 }else if (globaldata->sharedEstimators[i] == "sharedJclass") {
43 cDisplays.push_back(new CollectDisplay(new SharedJclass(), new SharedOneColumnFile(fileNameRoot+"SharedJclass", groupmap->namesOfGroups)));
44 }else if (globaldata->sharedEstimators[i] == "sharedSorClass") {
45 cDisplays.push_back(new CollectDisplay(new SharedSorClass(), new SharedOneColumnFile(fileNameRoot+"SharedSorClass", groupmap->namesOfGroups)));
46 }else if (globaldata->sharedEstimators[i] == "sharedJest") {
47 cDisplays.push_back(new CollectDisplay(new SharedJest(), new SharedOneColumnFile(fileNameRoot+"SharedJest", groupmap->namesOfGroups)));
48 }else if (globaldata->sharedEstimators[i] == "sharedSorEst") {
49 cDisplays.push_back(new CollectDisplay(new SharedSorEst(), new SharedOneColumnFile(fileNameRoot+"SharedSorEst", groupmap->namesOfGroups)));
50 }else if (globaldata->sharedEstimators[i] == "SharedThetaYC") {
51 cDisplays.push_back(new CollectDisplay(new SharedThetaYC(), new SharedOneColumnFile(fileNameRoot+"SharedThetaYC", groupmap->namesOfGroups)));
52 }else if (globaldata->sharedEstimators[i] == "SharedThetaN") {
53 cDisplays.push_back(new CollectDisplay(new SharedThetaN(), new SharedOneColumnFile(fileNameRoot+"SharedThetaN", groupmap->namesOfGroups)));
58 cout << "Standard Error: " << e.what() << " has occurred in the CollectSharedCommand class Function CollectSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
62 cout << "An unknown error has occurred in the CollectSharedCommand class function CollectSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
68 //**********************************************************************************************************************
70 CollectSharedCommand::~CollectSharedCommand(){
77 //**********************************************************************************************************************
79 int CollectSharedCommand::execute(){
82 read = new ReadPhilFile(globaldata->inputFileName);
83 read->read(&*globaldata);
85 input = globaldata->ginput;
86 list = globaldata->glist;
87 order = list->getSharedOrderVector();
91 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
92 //create collectors curve
93 cCurve = new Collect(order, cDisplays);
94 convert(globaldata->getFreq(), freq);
95 cCurve->getSharedCurve(freq);
99 cout << order->getLabel() << '\t' << count << endl;
102 list = input->getListVector(); //get new list vector to process
104 order = list->getSharedOrderVector(); //gets new order vector with group info.
112 for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
115 catch(exception& e) {
116 cout << "Standard Error: " << e.what() << " has occurred in the CollectSharedCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
120 cout << "An unknown error has occurred in the CollectSharedCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
126 //**********************************************************************************************************************