5 * Created by Sarah Westcott on 1/2/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "sharedcommand.h"
12 //**********************************************************************************************************************
14 SharedCommand::SharedCommand(){
16 globaldata = GlobalData::getInstance();
18 //getting output filename
19 filename = globaldata->inputFileName;
20 filename = getRootName(filename);
21 filename = filename + "shared";
22 openOutputFile(filename, out);
25 cout << "Standard Error: " << e.what() << " has occurred in the SharedCommand class Function SharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
29 cout << "An unknown error has occurred in the SharedCommand class function SharedCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
34 //**********************************************************************************************************************
36 int SharedCommand::execute(){
38 globaldata = GlobalData::getInstance();
41 read = new ReadPhilFile(globaldata->inputFileName);
42 read->read(&*globaldata);
43 input = globaldata->ginput;
44 list = globaldata->glist;
46 shared = new Shared();
49 shared->getSharedVectors(i, list); //fills sharedGroups with new info and updates sharedVector
50 list = input->getListVector(); //get new list vector to process
51 printSharedData(); //prints info to the .shared file
57 cout << "Standard Error: " << e.what() << " has occurred in the SharedCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
61 cout << "An unknown error has occurred in the SharedCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
66 //**********************************************************************************************************************
67 void SharedCommand::printSharedData() {
69 //prints out horizontally
70 for (it = shared->sharedGroups.begin(); it != shared->sharedGroups.end(); it++) {
71 out << it->second->getLabel() << "\t" << it->first << "\t"; //prints out label and groupname
72 it->second->print(out); // prints sharedrabundvector
76 cout << "Standard Error: " << e.what() << " has occurred in the SharedCommand class Function printSharedData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
80 cout << "An unknown error has occurred in the SharedCommand class function printSharedData. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
86 //**********************************************************************************************************************
88 SharedCommand::~SharedCommand(){
93 //**********************************************************************************************************************