Esempio n. 1
0
  public static void test1() {
    Sequence[] seqs = Parser.test1();
    double[][] distances = (new GappedHammingDistance()).getDistanceMatrix(seqs);
    DecimalFormat f = new DecimalFormat("0000.000");

    System.out.println("   " + seqs.length);

    for (int i = 0; i < seqs.length; i++) {
      System.out.print(seqs[i].name);
      for (int k = 0; k < 10 - seqs[i].name.length(); k++) {
        System.out.print(" ");
      }
      System.out.print("  ");
      int cols = 1;
      for (int j = 0; j < seqs.length; j++) {
        if (i != j) {
          int di = i;
          int dj = j;
          // force symmetric matrix - arg - what the???
          // testing!!!
          if (j > i) {
            di = j;
            dj = i;
          }
          double d = distances[di][dj];
          // testing
          if (d > 2000) {
            System.err.println("ARGH");
          }
          System.out.print(f.format(d));
        } else {
          System.out.print(f.format(0));
        }
        System.out.print("  ");
        cols++;
        if (cols >= 7) {
          System.out.println();
          System.out.print("  ");
          cols = 0;
        }
      }
      if (cols != 7) {
        System.out.println();
      }
    }
  }