From: miles Date: Wed, 25 Jul 2012 20:48:54 +0000 (+0000) Subject: Added webpage stuff. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=e03122fd8b2e7b22ea8e4d041941f78ef8008c6b;p=old-jaiswallab-svn%2F.git Added webpage stuff. svn path=/; revision=370 --- diff --git a/Personnel/miles/2/src/Heatmap.java b/Personnel/miles/2/src/Heatmap.java index 6d72a35..2c587c2 100644 --- a/Personnel/miles/2/src/Heatmap.java +++ b/Personnel/miles/2/src/Heatmap.java @@ -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");