Hello!

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

Note that updates take place every 10 minutes, commits may not be seen immediately.
Added webpage stuff.
authormiles <miles@localhost>
Wed, 25 Jul 2012 20:48:54 +0000 (20:48 +0000)
committermiles <miles@localhost>
Wed, 25 Jul 2012 20:48:54 +0000 (20:48 +0000)
svn path=/; revision=370

Personnel/miles/2/src/Heatmap.java

index 6d72a3598eb182e9099823fd92f5d90df90abe39..2c587c255e22b6f87dbf5b16046dd1213d3c7a55 100644 (file)
@@ -23,6 +23,7 @@ public class Heatmap {
        String[] species;
        static int[] allClusterIDs;
        static int maxCount = 0;
+       static String option = "webpage";
        
        public static void main(String[] args) {
                String[] geneIDs = new String[] {"mgf009407m", "GRMZM2G457201_T02", "LOC_Os03g53530.1", "Bradi3g44220.1"};
@@ -30,15 +31,44 @@ public class Heatmap {
                Species[] species = getHeatChartData(geneIDs);
                
                // IF asked for table
-               //generateDelimitedTable(species);
+               if (option.equals("table")) {
+                       generateDelimitedTable(species);
+               }
                
                // IF asked for image
-               generateHeatMapImage(species);
-               
+               if (option.equals("image")) {
+                       generateHeatMapImage(species);  
+               }
                // IF asked for webpage
-               //displayHeatChart(species);
+               if (option.equals("webpage")) {
+                       //return generateWebPageData(species);
+               }
+               //return null;
        }
        
+       private static String[][] generateWebPageData(Species[] species) {
+               String[][] heatChartData = new String[species.length + 1][];
+               heatChartData[0] = new String[species.length];
+               for(int s = 0; s < species.length; s ++) {
+                       heatChartData[0][s] = species[s].name;
+               }
+               for(int s = 1; s <= species.length; s ++) {
+                       heatChartData[s] = new String[allClusterIDs.length];
+                       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;
+                }
+                heatChartData[s][c] = Integer.toString(frequency);
+                       }
+               }
+               
+               return heatChartData;
+       }
+       
+       
     private static void generateHeatMapImage(Species[] species) {
         
        File output = new File("heatMap");