2 * rarefactsharedcommand.cpp
5 * Created by Sarah Westcott on 1/6/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "rarefactsharedcommand.h"
11 #include "sharedsobs.h"
13 //**********************************************************************************************************************
15 RareFactSharedCommand::RareFactSharedCommand(){
17 globaldata = GlobalData::getInstance();
18 string fileNameRoot, groups;
19 fileNameRoot = getRootName(globaldata->inputFileName);
20 groupmap = globaldata->gGroupmap;
22 //initialize groups for label
24 for (int i = 0; i < groupmap->namesOfGroups.size(); i++) {
25 groups = groups + groupmap->namesOfGroups[i];
29 for (i=0; i<globaldata->sharedRareEstimators.size(); i++) {
30 if (globaldata->sharedRareEstimators[i] == "sharedobserved") {
31 rDisplays.push_back(new RareDisplay(new SharedSobs(), new SharedThreeColumnFile(fileNameRoot+"r_shared.observed", groups)));
36 cout << "Standard Error: " << e.what() << " has occurred in the RareFactSharedCommand class Function RareFactSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
40 cout << "An unknown error has occurred in the RareFactSharedCommand class function RareFactSharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
46 //**********************************************************************************************************************
48 RareFactSharedCommand::~RareFactSharedCommand(){
55 //**********************************************************************************************************************
57 int RareFactSharedCommand::execute(){
60 read = new ReadPhilFile(globaldata->inputFileName);
61 read->read(&*globaldata);
63 input = globaldata->ginput;
64 SharedList = globaldata->gSharedList;
65 order = SharedList->getSharedOrderVector();
69 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
70 //create collectors curve
71 rCurve = new Rarefact(order, rDisplays);
72 convert(globaldata->getFreq(), freq);
73 convert(globaldata->getIters(), nIters);
74 rCurve->getSharedCurve(freq, nIters);
78 cout << order->getLabel() << '\t' << count << endl;
81 SharedList = input->getSharedListVector(); //get new list vector to process
82 if (SharedList != NULL) {
83 order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
91 for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
95 cout << "Standard Error: " << e.what() << " has occurred in the RareFactSharedCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
99 cout << "An unknown error has occurred in the RareFactSharedCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
105 //**********************************************************************************************************************