static int[] allClusterIDs;
public static void main(String[] args) {
- //String[] geneIDs = new String[] {"mgf009407m", "GRMZM2G457201_T02", "LOC_Os03g53530.1", "Bradi3g44220.1"};
- Species[] species = getHeatChartData(args);
+ String[] geneIDs = new String[] {"mgf009407m", "GRMZM2G457201_T02", "LOC_Os03g53530.1", "Bradi3g44220.1"};
+
+ Species[] species = getHeatChartData(geneIDs);
// IF asked for table
generateDelimitedTable(species);
}
PrintWriter printWriter = new PrintWriter(fileWriter);
- printWriter.print("Species \t");
+ /*printWriter.print("Species \t");
for (int clust = 0; clust < allClusterIDs.length; clust ++) {
printWriter.print("Cluster " + clust + "\t");
}
}
}
printWriter.close();
- }
+ */
+
+ printWriter.print("Cluster id");
+ for (int s = 0; s< species.length; s++) {
+ printWriter.print("\t" + species[s].name);
+ }
+ for (int c = 0; c < allClusterIDs.length; c ++) {
+ printWriter.print("\n" + c);
+ for (int s = 0; s < species.length; s ++) {
+ int frequency = species[s].findClusterFrequency(allClusterIDs[c]);
+ if (frequency == -1) {
+ frequency = 0;
+ }
+ printWriter.print("\t" + frequency);
+ }
+
+ }
+ }
// creates a connection, distributes work and information to the various helper functions
// gathers the final list of species and their geneMaps in one place
"group by species, super_id order by species");
} catch (SQLException e) {
System.out.println("Statement failed to prepare");
+ System.err.println("SQLException: " + e.getMessage());
}
}
catch (SQLException e) {
System.out.println("Could not execute Query, possible error in statement");
+ System.err.println("SQLException: " + e.getMessage());
}
try {
}
catch (SQLException e) {
System.out.println("Error in returned data - check database");
+ System.err.println("SQLException: " + e.getMessage());
}
rawSpecies = new Species[speciesCount]; // initialize it to the correct size
}
catch (SQLException e) {
System.out.println("Unexpected Error");
+ System.err.println("SQLException: " + e.getMessage());
}
rawSpecies = groupSpecies(rawSpecies);
logicStatement = logicStatement + "'";
}
}
+ System.out.println(geneIDs.length);
+ System.out.println(logicStatement);
// finds the clusters that the genes are in
PreparedStatement findCluster;
+ logicStatement);
} catch (SQLException e1) {
System.out.println("Statment failed to prepare");
+ System.err.println("SQLException: " + e1.getMessage());
findCluster = null;
}
rs = findCluster.executeQuery();
} catch (SQLException e) {
System.out.println("Unable to execute Query");
+ System.err.println("SQLException: " + e.getMessage());
}
int totalClusters = 0;
rs.beforeFirst();
} catch (SQLException e) {
System.out.println("Error in data, unable to parse");
+ System.err.println("SQLException: " + e.getMessage());
}
allClusters = new int[totalClusters];
allClusters[i] = rs.getInt(1);
} catch (SQLException e) {
System.out.println("Genes overlap");
+ System.err.println("SQLException: " + e.getMessage());
}
}
useDatabase = connection.prepareStatement("USE inparanoid_data");
} catch (SQLException e2) {
System.out.println("Unexpected Error");
+ System.err.println("SQLException: " + e2.getMessage());
useDatabase = null;
}
try {
useDatabase.execute();
} catch (SQLException e) {
System.out.println("Unexpected Error");
+ System.err.println("SQLException: " + e.getMessage());
}
return connection;
}
}
catch(SQLException x) {
System.out.println("Couldn’t get connection!");
+ System.err.println("SQLException: " + x.getMessage());
}
return null;
}