Ejemplo n.º 1
0
 public TestAnneal(
     double targetTemp,
     Oligo oligo,
     int amplicon,
     double shiftRange,
     int lenMin,
     int lenMax,
     boolean forward,
     boolean sense,
     boolean modified)
     throws IOException {
   super(
       mage.Tools.FASTA.readFFN(Constants.blastdirectory, "genome.ffn"),
       targetTemp,
       oligo,
       amplicon,
       shiftRange,
       lenMin,
       lenMax,
       forward,
       sense,
       modified);
   // creationTracker = new int[matrix.length][matrix[0].length];
   epochTracker = new Integer[matrix.length][matrix[0].length];
   mcsTracker = new Integer[matrix.length][matrix[0].length];
   scoreTracker = new Double[matrix.length][matrix[0].length];
 }
Ejemplo n.º 2
0
  public static void main(String[] args) throws Exception {
    String gen = mage.Tools.FASTA.readFFN(Constants.blastdirectory, "genome.ffn");
    Oligo o = Oligo.InsertionFactory(gen, "TAG", 3090358, 2, true, "endA");
    // Oligo o = Oligo.MismatchFactory(genome, "A", left_position, right_position, replichore, true,
    // genome)

    // test Move
    if (false) {
      TestAnneal ta = new TestAnneal(60.0, o, 400, .05, 16, 30, false, true, false);
      System.out.println("TestMove in Two dimensions, T = " + ta.initialT);
      ta.testGetMove(ta.initialT);

      float cooledT = ta.cool(ta.initialT);
      cooledT = ta.cool(cooledT);
      System.out.println("Partially cooled, T = " + cooledT);
      ta.testGetMove(cooledT);
      System.out.println("Fully Cooled, T = " + ta.finalT);
      ta.testGetMove(ta.finalT);
      ta = new TestAnneal(60.0, o, 400, 0, 16, 30, false, true, false);
      System.out.println("TestMove, No shifting");
      ta.testGetMove(ta.initialT); // no shifting allowed
      ta = new TestAnneal(60.0, o, 400, .05, 20, 20, false, true, false);
      System.out.println("TestMove, Fixed length");
      ta.testGetMove(ta.initialT); // fixed length
    }

    // test Cool
    if (false) {
      // Slowdown
      Anneal.setCoolingType(CoolingType.SLOWDOWN);
      TestAnneal ta = new TestAnneal(60.0, o, 400, .05, 16, 30, false, true, false);
      ta.testCool();
      // Linear
      Anneal.setCoolingType(CoolingType.LINEAR);
      ta = new TestAnneal(60.0, o, 400, .05, 16, 30, false, true, false);
      ta.testCool();
    }

    // test getOptimizedPrimer
    if (false) {
      TestAnneal ta = new TestAnneal(60.0, o, 400, .05, 10, 30, false, true, false);
      Anneal.random.setSeed(9999l);
      ta.testOptimize();
      ta = new TestAnneal(60.0, o, 400, .05, 10, 30, false, true, false);
      Anneal.random.setSeed(8888l);
      ta.testOptimize();
      ta = new TestAnneal(60.0, o, 400, .05, 10, 30, false, true, false);
      Anneal.random.setSeed(7777l);
      ta.testOptimize();
    }

    // test accept
    if (false) {
      TestAnneal ta = new TestAnneal(60.0, o, 400, .05, 10, 30, false, true, false);
      System.out.println("Test Accept at initial temp");
      Anneal.random.setSeed(999l);
      ta.testAccept(ta.initialT);
      ta.testAccept2(ta.initialT);
      System.out.println("Test Accept at final temp");
      Anneal.random.setSeed(888l);
      // ta.testAccept(ta.finalT);

    }

    // test initial temp
    if (false) {
      TestAnneal ta = new TestAnneal(60.0, o, 400, .05, 10, 30, false, true, false);
      ta.testInitialTemp();
      ta.testInitialTemp();
      ta.testInitialTemp();
    }

    // test a particular problem primer
    if (true) {
      String directory = Constants.blastdirectory + "nat/";
      String genome = FASTA.readFFN(directory, "genome.FASTA");
      Oligo.Directory = directory;
      Oligo.Genome = "genome.FASTA";
      o = Oligo.MismatchFactory(genome, "A", 4572079, 4572079, 1, true, "avrII07");
      TestAnneal ta = new TestAnneal(60.0, o, 500, .05, 10, 30, false, true, true);
      ta.testOptimize();
    }
  }