File: heatmap.h

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (80 lines) | stat: -rwxr-xr-x 2,233 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef HEATMAP_H
#define HEATMAP_H
/*
 *  heatmap.h
 *  Mothur
 *
 *  Created by Sarah Westcott on 3/25/09.
 *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
 *
 */

#include "sharedrabundvectors.hpp"
#include "rabundvector.hpp"
#include "sharedrabundfloatvectors.hpp"
#include "utils.hpp"

/***********************************************************************/
struct binCount {
		int bin;
		int abund;
		binCount(int i, int j) : bin(i), abund(j) {}
};
/***********************************************************************/
struct binCountFloat {
		int bin;
		float abund;
		binCountFloat(int i, float j) : bin(i), abund(j) {}
};

/***********************************************************************/
//sorts highest abund to lowest
inline bool comparebinCounts(binCount left, binCount right){
	return (left.abund > right.abund);	
}
/***********************************************************************/
//sorts highest abund to lowest
inline bool comparebinFloatCounts(binCountFloat left, binCountFloat right){
	return (left.abund > right.abund);	
}
/***********************************************************************/

class HeatMap {
	
	public:
		HeatMap(string, string, int, int, string, string);
		~HeatMap(){};
	
		string getPic(RAbundVector*);
		string getPic(SharedRAbundVectors*&);
		string getPic(SharedRAbundFloatVectors*&);

	private:
		vector<string> sortSharedVectors(vector<SharedRAbundVector*>, vector<string>);
		vector<string> sortSharedVectors(vector<SharedRAbundFloatVector*>, vector<string>);
		int sortRabund(RAbundVector*);
		void printLegend(int, float);

		string format, sorted, groupComb, scaler, outputDir, inputfile;
		ofstream outsvg;
		MothurOut* m;
        Utils util;
		int numOTU, fontSize;
		
		map<int, int> orderTopGroup(vector<SharedRAbundVector*>);
		map<int, int> orderTopOtu(vector<SharedRAbundVector*>);
		map<int, int> orderShared(vector<SharedRAbundVector*>);
		map<int, int> orderTopGroup(vector<SharedRAbundFloatVector*>);
        map<int, int> orderTopOtu(vector<SharedRAbundFloatVector*>);
		map<int, int> orderShared(vector<SharedRAbundFloatVector*>);

			
};

/***********************************************************************/

#endif