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;
72 if (format != "list") {
74 util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "heat");
75 globaldata->setGroups("");
80 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(order->getLabel()) == 1){
82 cout << order->getLabel() << '\t' << count << endl;
83 heatmap->getPic(order);
87 //get next line to process
88 if (format == "sharedfile") {
89 order = input->getSharedOrderVector();
91 //you are using a list and a groupfile
92 SharedList = input->getSharedListVector(); //get new list vector to process
93 if (SharedList != NULL) {
94 order = SharedList->getSharedOrderVector(); //gets new order vector with group info.
102 //reset groups parameter
103 globaldata->Groups.clear();
106 while(ordersingle != NULL){
108 if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(ordersingle->getLabel()) == 1){
110 cout << ordersingle->getLabel() << '\t' << count << endl;
111 heatmap->getPic(ordersingle);
115 ordersingle = (input->getOrderVector());
122 catch(exception& e) {
123 cout << "Standard Error: " << e.what() << " has occurred in the HeatMapCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
127 cout << "An unknown error has occurred in the HeatMapCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
132 //**********************************************************************************************************************