Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Add back code to use the heatchart.java method
authorelserj <elserj@localhost>
Wed, 15 Aug 2012 17:40:48 +0000 (17:40 +0000)
committerelserj <elserj@localhost>
Wed, 15 Aug 2012 17:40:48 +0000 (17:40 +0000)
svn path=/; revision=375

Personnel/miles/2/src/Heatmap.java

index f7470032019ebf0a78fee46a22a12609083768bb..df9a90da43d25b39171e8caf1786a684b8716a85 100644 (file)
@@ -55,7 +55,7 @@ public class Heatmap {
        
     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;
@@ -91,7 +91,8 @@ public class Heatmap {
                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));
                }
                
@@ -117,6 +118,54 @@ public class Heatmap {
                } 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");
+        }
+        */
         
     }