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;
  }
 public Map<String, Boolean> getChangeDirections(
     List<String> genes, Set<String> g1, Set<String> g2) {
   boolean[][] b = getExclusiveMutations(g1, g2);
   Map<String, Boolean> dirs = new HashMap<String, Boolean>();
   for (String gene : genes) {
     dirs.put(gene, getChangeDirection(gene, b[0], b[1]));
   }
   return dirs;
 }
 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));
   }
 }
  private Map<String, Double> getExpressionPvals(
      Set<String> targets, boolean[] set1, boolean[] set2) {
    Map<String, Double> map = new HashMap<String, Double>();

    Histogram2D h = new Histogram2D(0.2);

    System.out.println("targets = " + targets.size());
    Progress prg = new Progress(targets.size());
    for (String sym : targets) {
      prg.tick();

      if (expMan.getNonZeroRatio(sym) == 0) continue;
      double pval = calcDiffPval(sym, set1, set2, true);

      if (Double.isNaN(pval)) continue;
      if (pval == 0) pval = 1E-11;

      double pPerm = calcDiffPval(sym, set1, set2, false);
      if (pPerm == 0) pPerm = 1E-5;

      h.count(-Math.log(pval), -Math.log(pPerm));

      // pval = 0 is not real and it is not compatible with fisher's combined probability.
      // below is a better approximation.
      //			if (pval == 0)
      //			{
      //				pval = 1E-11;
      //			}

      map.put(sym, pval);
    }

    Histogram2DPlot p = new Histogram2DPlot(h);
    p.setLines(Arrays.asList(new double[] {1, 0}));
    p.setVisible(true);

    return map;
  }