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"};
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");