public List<String> find() throws IOException { // Set<String> g1 = new HashSet<String>(Arrays.asList("HRAS", "NRAS", "KRAS")); // Set<String> g2 = new HashSet<String>(Arrays.asList("BRAF")); Set<String> g1 = new HashSet<String>(Arrays.asList("HRAS")); Set<String> g2 = new HashSet<String>(Arrays.asList("NRAS", "KRAS")); Map<String, Double> pvals = calcDifferencePvals(g1, g2); System.out.println("pvals.size() = " + pvals.size()); List<String> list = FDR.select(pvals, null, fdrThr); System.out.println("result size = " + list.size()); Map<String, Boolean> dirs = getChangeDirections(list, g1, g2); int up = 0; int dw = 0; for (String gene : dirs.keySet()) { Boolean d = dirs.get(gene); if (d) up++; else dw++; } System.out.println("up = " + up); System.out.println("dw = " + dw); return list; }
private double[] toDoubleArray(Map<String, Double> map) { double[] d = new double[map.size()]; int i = 0; for (String key : map.keySet()) { d[i++] = map.get(key); } return d; }
private void printResults(Map<String, Double> pvals, List<String> list) { for (String s : list) { System.out.println( s + "\t" + FormatUtil.roundToSignificantDigits(pvals.get(s), 2) + "\t" + affectedDw.get(s)); } }