private static void generateHeatMapImage(Species[] species) {
- File output = new File("heatMap");
+ File output = new File("heatMap.gif");
int heatMapHeight = 25*allClusterIDs.length;
int heatMapWidth = 25*species.length;
chartGraphics.drawString("Heat Map", 25, 25);
for (int c = 0; c < allClusterIDs.length; c ++) {
- String clusterID = Integer.toString(allClusterIDs[c]);
+ String clusterID = Integer.toString(allClusterIDs[c] + 1);
+ System.out.println(allClusterIDs[c]);
chartGraphics.drawString(clusterID, 5, (speciesNameLength + 15 + c*25));
}
} catch (IOException e) {
System.out.println("Unable to write Heat Map Image");
}
+
+ /*
+ double[][] heatMapVals = new double[allClusterIDs.length][species.length];
+ for (int s = 0; s < species.length; s ++) {
+ for (int c = 0; c < allClusterIDs.length; c ++) {
+ int frequency = species[s].findClusterFrequency(allClusterIDs[c]);
+ // -1 means that species contains no genes in the specified cluster, but can't have negative color
+ // ensure that frequency is never negative
+ if (frequency == -1) {
+ frequency = 0;
+ }
+ heatMapVals[c][s] = frequency;
+ }
+ }
+ String[] names = new String[species.length];
+ for (int s = 0; s < species.length; s ++) {
+ names[s] = species[s].name;
+ }
+ HeatChart heatChart = new HeatChart(heatMapVals);
+ Color axisColor = new Color(0, 0, 0);
+ Color background = new Color(255, 255, 255);
+ Dimension cellSize = new Dimension(20, 20);
+ heatChart.setAxisColour(axisColor);
+ heatChart.setBackgroundColour(background);
+ heatChart.setCellSize(cellSize);
+ heatChart.setXValues(names);
+ heatChart.setTitle("Heat Map");
+ heatChart.setYAxisLabel("Cluster ID");
+ heatChart.setXAxisLabel("Species");
+ heatChart.setHighValueColour(Color.red);
+ heatChart.setLowValueColour(Color.blue);
+ heatChart.setAxisThickness(1);
+ heatChart.setColourScale(0.8);
+ heatChart.setHighValueColour(Color.red);
+ heatChart.setLowValueColour(Color.blue);
+ heatChart.setAxisThickness(1);
+ heatChart.setColourScale(0.8);
+
+ Image heatMap = heatChart.getChartImage();
+
+ File output = new File("heatMap.gif");
+
+ try {
+ ImageIO.write((RenderedImage) heatMap, "gif", output);
+ } catch (IOException e) {
+ System.out.println("Unable to write image to file");
+ }
+ */
}