示例#1
0
  /**
   * This is a test for viewing the result of mate or other operation can be executed from two
   * genome the first genome is xFileNameA and second genome is xFileNameB
   */
  public static void Experiment4(String xFileNameA, String xFileNameB) {
    StringTokenizer st;
    String curword;
    String xline;
    String fnamebuf;
    IOseq xFile;
    int id;
    Genome gA = null;
    Genome gB = null;

    System.out.println("------ Start experiment 4 -------");
    // read genome A
    //
    xFile = new IOseq(xFileNameA);
    boolean ret = xFile.IOseqOpenR();

    if (ret) {

      try {
        System.out.println(" Read genome-A");
        xline = xFile.IOseqRead();
        st = new StringTokenizer(xline);
        // skip
        curword = st.nextToken();
        // id of genome can be readed
        curword = st.nextToken();
        id = Integer.parseInt(curword);
        gA = new Genome(id, xFile);
        // view genotype A
      } catch (Throwable e) {
        System.err.println(e + " : error during read " + xFileNameA);
      }

      xFile.IOseqCloseR();
    } else System.err.print("\n : error during openA " + xFileNameA);

    //
    // read genome B
    //
    xFile = new IOseq(xFileNameB);
    ret = xFile.IOseqOpenR();

    if (ret) {

      try {
        System.out.println("\n Read genome-B");
        xline = xFile.IOseqRead();
        st = new StringTokenizer(xline);
        // skip
        curword = st.nextToken();
        // id of genome can be readed
        curword = st.nextToken();
        id = Integer.parseInt(curword);
        gB = new Genome(id, xFile);
        // view genotype A
      } catch (Throwable e) {
        System.err.println(e + " : error during open " + xFileNameB);
      }

      xFile.IOseqCloseR();
    } else System.err.print("\n : error during openB " + xFileNameB);

    //   	Genome gC = gA.mate_multipoint(gB,3,0.6,0.3);
    //   	Genome gC = gA.mate_multipoint_avg(gB,3,0.6,0.3);

    System.out.println("\n ----genome-A----------");
    gA.op_view();
    System.out.println("\n ----genome-B----------");
    gB.op_view();

    //	gA.DEBUGmate_singlepoint(gB,3);

    System.out.println("\n ----genome-RESULT----------");
    Genome gC = gA.mate_singlepoint(gB, 999);

    // this step is for verify if correct genome
    gC.verify();
    // this step is for verify the phenotype created
    gC.genesis(999);
    // the step print the result genome
    gC.op_view();

    // for viewing the imagine of two genome input and the genome output

    System.out.println("\n *******  D I S P L A Y      G R A P H   *********");
    gA.View_mate_singlepoint(gB, 999);
    System.out.println("\n *************************************************");

    System.out.println("\n\n End of experiment");
  }