private void writeWeights(
      String orig, GeneBranch from, GeneBranch to, String edgeType, Writer writer)
      throws IOException {
    Set<String> dwstr = to.getAllGenes();
    dwstr.retainAll(downstream.get(orig));
    assert !dwstr.isEmpty();
    double cumPval = calcPVal(orig, dwstr);
    boolean upreg = calcChangeDirection(orig, to.gene);

    String key = from.gene + " " + edgeType + " " + to.gene;
    writer.write("edge\t" + key + "\tcolor\t" + val2Color(cumPval, 0) + "\n");
    writer.write("edge\t" + key + "\twidth\t2\n");

    if (affectedDw.get(orig).contains(to.gene)) {
      double pval = calcPVal(orig, Collections.singleton(to.gene));
      writer.write("node\t" + to.gene + "\tcolor\t" + val2Color(pval, upreg ? 1 : -1) + "\n");
    } else {
      writer.write("node\t" + to.gene + "\tcolor\t255 255 255\n");
    }
  }
 private int countShared(GeoPoint[] a, GeoPoint[] b) {
   Set<GeoPoint> points = new HashSet<GeoPoint>(Arrays.asList(a));
   points.retainAll(Arrays.asList(b));
   return points.size();
 }