public void testDebug() {
    int POP_SIZE = 50;
    int numAlleles = 10;
    int numLoci = 10;
    POP_MODEL.loadDefaults();
    POP_MODEL.setIncParents(true);
    POP_MODEL.setAllelicFreqType(ButlerFamilyData.EQUAL_FREQ);
    POP_MODEL.setSize(POP_SIZE);
    POP_MODEL.setFamilyType(ButlerFamilyData.BUTLER_50x1);

    POP_MODEL.setNumLoci(numLoci);
    POP_MODEL.setNumAlleles(numAlleles);

    KinGroupProjectV1.makeInstance("SimpsPopFactoryTest", "1");
    POP_MODEL.setFamilyType(ButlerFamilyData.BUTLER_50x1);
    OldAlleleFreq freq = OldAlleleFreqFactory.makeAlleleFreq(POP_MODEL);
    freq.normalize(1.0f, false);

    GenotypeFactory.init();
    POP_MODEL.setIncParents(false);
    //         POP_MODEL.setIncludeParents(true);
    OldPop popA = new ButlerPopBuilder(freq).buildButler(POP_MODEL);

    SysPop simsPop = OldPopToSysPopFactory.makePopFrom(popA);

    System.out.println(new JWAlg_v2_HapDip(simsPop, freq).makeOutgoingData(new Date()));
  }
示例#2
0
 protected double calcOneDistance(OldPop popA) {
   PopToPartitionFactory factory =
       PopToPartitionFactory.makeInstance(
           popA); // must be called here, since we created a new population
   Partition partA = factory.makeFromPopulation(popA);
   SysPop pop = OldPopToSysPopFactory.makePopFrom(popA);
   SIMPS2Alg method = new SIMPS2Alg(pop, ALG_MODEL);
   Partition partB = method.partition();
   int dist = new LitowDistance().distance(partA, partB);
   //      if (dist != 0) {
   //         LOG.trace(this, "A=", partA);
   //         LOG.trace(this, "B=", partB);
   //         LOG.trace(this, "D(A,B)=", Integer.toString(dist));
   //      }
   return dist;
 }
  public void testSingleTest() {

    int POP_SIZE = 50;
    int numAlleles = 10;
    int numLoci = 10;
    POP_MODEL.loadDefaults();
    POP_MODEL.setIncParents(true);
    POP_MODEL.setAllelicFreqType(ButlerFamilyData.EQUAL_FREQ);
    POP_MODEL.setSize(POP_SIZE);
    POP_MODEL.setFamilyType(ButlerFamilyData.BUTLER_50x1);

    POP_MODEL.setNumLoci(numLoci);
    POP_MODEL.setNumAlleles(numAlleles);

    KinGroupProjectV1.makeInstance("SimpsPopFactoryTest", "3");
    POP_MODEL.setFamilyType(ButlerFamilyData.BUTLER_6x2);
    OldAlleleFreq freq = OldAlleleFreqFactory.makeAlleleFreq(POP_MODEL);
    freq.normalize(1.0f, false);

    GenotypeFactory.init();
    POP_MODEL.setIncParents(false);
    //         POP_MODEL.setIncludeParents(true);
    OldPop popA = new ButlerPopBuilder(freq).buildButler(POP_MODEL);

    SysPop simsPop = OldPopToSysPopFactory.makePopFrom(popA);
    JWAlg_v2_HapDip f = new JWAlg_v2_HapDip(simsPop, freq);
    f.setDebug(true);
    Partition partB = f.partition();
    System.out.println(partB);
    PopToPartitionFactory factory =
        PopToPartitionFactory.makeInstance(
            popA); // must be called here, since we created a new population
    Partition partA = factory.makeFromPopulation(popA);

    int dist = new LitowDistance().distance(partA, partB);
    if (dist != 0) {
      LOG.report(this, "A=" + partA);
      LOG.report(this, "B=" + partB);
      LOG.report(this, "D(A,B)=" + Integer.toString(dist));
      dist = new LitowDistance().distance(partA, partB);
    }
    assertEquals(0, dist);
  }