5 * Created by Sarah Westcott on 3/25/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "heatmapcommand.h"
13 //**********************************************************************************************************************
15 HeatMapCommand::HeatMapCommand(){
17 globaldata = GlobalData::getInstance();
18 heatmap = new HeatMap();
19 format = globaldata->getFormat();
22 cout << "Standard Error: " << e.what() << " has occurred in the HeatMapCommand class Function HeatMapCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
26 cout << "An unknown error has occurred in the HeatMapCommand class function HeatMapCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
30 //**********************************************************************************************************************
32 HeatMapCommand::~HeatMapCommand(){
38 //**********************************************************************************************************************
40 int HeatMapCommand::execute(){
44 if (format == "sharedfile") {
46 read = new ReadOTUFile(globaldata->inputFileName);
47 read->read(&*globaldata);
49 input = globaldata->ginput;
50 lookup = input->getSharedRAbundVectors();
51 }else if (format == "list") {
52 //you are using just a list file and have only one group
53 read = new ReadOTUFile(globaldata->inputFileName);
54 read->read(&*globaldata);
56 rabund = globaldata->rabund;
57 input = globaldata->ginput;
60 if (format != "list") {
62 while(lookup[0] != NULL){
64 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){
66 cout << lookup[0]->getLabel() << '\t' << count << endl;
67 heatmap->getPic(lookup);
71 for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
73 //get next line to process
74 lookup = input->getSharedRAbundVectors();
78 //reset groups parameter
79 globaldata->Groups.clear();
83 while(rabund != NULL){
85 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(rabund->getLabel()) == 1){
87 cout << rabund->getLabel() << '\t' << count << endl;
88 heatmap->getPic(rabund);
92 rabund = input->getRAbundVector();
97 globaldata->setGroups("");
100 catch(exception& e) {
101 cout << "Standard Error: " << e.what() << " has occurred in the HeatMapCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
105 cout << "An unknown error has occurred in the HeatMapCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
110 //**********************************************************************************************************************