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();
20 util = new SharedUtil();
24 cout << "Standard Error: " << e.what() << " has occurred in the HeatMapCommand class Function HeatMapCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
28 cout << "An unknown error has occurred in the HeatMapCommand class function HeatMapCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
32 //**********************************************************************************************************************
34 HeatMapCommand::~HeatMapCommand(){
41 //**********************************************************************************************************************
43 int HeatMapCommand::execute(){
47 if (format == "sharedfile") {
49 read = new ReadPhilFile(globaldata->inputFileName);
50 read->read(&*globaldata);
52 input = globaldata->ginput;
53 order = input->getSharedOrderVector();
54 }else if (format == "shared") {
55 //you are using a list and a groupfile
56 read = new ReadPhilFile(globaldata->inputFileName);
57 read->read(&*globaldata);
59 input = globaldata->ginput;
60 SharedList = globaldata->gSharedList;
61 order = SharedList->getSharedOrderVector();
62 }else if (format == "list") {
63 //you are using just a list file and have only one group
64 read = new ReadPhilFile(globaldata->inputFileName);
65 read->read(&*globaldata);
67 ordersingle = globaldata->gorder;
68 input = globaldata->ginput;
71 if (format != "list") {
73 util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "heat");
74 globaldata->setGroups("");
79 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
81 cout << order->getLabel() << '\t' << count << endl;
82 heatmap->getPic(order);
86 //get next line to process
87 if (format == "sharedfile") {
88 order = input->getSharedOrderVector();
90 //you are using a list and a groupfile
91 SharedList = input->getSharedListVector(); //get new list vector to process
92 if (SharedList != NULL) {
93 order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
101 //reset groups parameter
102 globaldata->Groups.clear();
105 while(ordersingle != NULL){
107 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(ordersingle->getLabel()) == 1){
109 cout << ordersingle->getLabel() << '\t' << count << endl;
110 heatmap->getPic(ordersingle);
114 ordersingle = (input->getOrderVector());
121 catch(exception& e) {
122 cout << "Standard Error: " << e.what() << " has occurred in the HeatMapCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
126 cout << "An unknown error has occurred in the HeatMapCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
131 //**********************************************************************************************************************