Esempio n. 1
0
 @Test
 public void PED_writer() throws Exception {
   File newPed = new File(testPed.getAbsolutePath().replace(testPed.getName(), "new.ped"));
   PedFileWriter w = new PedFileWriter(newPed);
   try {
     w.writeAll(pedfd.getAllEntries());
     boolean filesAreEqual = DirectoryCompare.compareFileContent(testPed, newPed);
     assertTrue(filesAreEqual);
   } finally {
     w.close();
   }
 }
Esempio n. 2
0
  // TODO
  @Test
  public void PED_getEntries() throws Exception {
    // 1 1 0 0 1 1 A A G T
    assertEquals('A', pedfd.getAllEntries().get(0).getBialleles().get(0).getAllele1());
    assertEquals('A', pedfd.getAllEntries().get(0).getBialleles().get(0).getAllele2());
    assertEquals('G', pedfd.getAllEntries().get(0).getBialleles().get(1).getAllele1());
    assertEquals('T', pedfd.getAllEntries().get(0).getBialleles().get(1).getAllele2());

    assertEquals('A', pedfd.getAllEntries().get(1).getBialleles().get(0).getAllele1());
    assertEquals('C', pedfd.getAllEntries().get(1).getBialleles().get(0).getAllele2());
    assertEquals('T', pedfd.getAllEntries().get(1).getBialleles().get(1).getAllele1());
    assertEquals('G', pedfd.getAllEntries().get(1).getBialleles().get(1).getAllele2());

    assertEquals('C', pedfd.getAllEntries().get(5).getBialleles().get(0).getAllele1());
    assertEquals('C', pedfd.getAllEntries().get(5).getBialleles().get(0).getAllele2());
    assertEquals('T', pedfd.getAllEntries().get(5).getBialleles().get(1).getAllele1());
    assertEquals('T', pedfd.getAllEntries().get(5).getBialleles().get(1).getAllele2());

    assertEquals("3", pedfd.getAllEntries().get(2).getFamily());
    assertEquals("0", pedfd.getAllEntries().get(2).getFather());
    assertEquals("0", pedfd.getAllEntries().get(2).getMother());
    assertEquals(1.0, pedfd.getAllEntries().get(2).getPhenotype());
    assertEquals("1", pedfd.getAllEntries().get(2).getIndividual());
    assertEquals(1, pedfd.getAllEntries().get(2).getSex());

    assertEquals("3", pedfd.getEntries(2, 3).get(0).getFamily());
    assertEquals('G', pedfd.getEntries(2, 3).get(0).getBialleles().get(1).getAllele2());
    assertEquals("3", pedfd.getEntries(0, 3).get(2).getFamily());
    assertEquals('G', pedfd.getEntries(0, 3).get(2).getBialleles().get(1).getAllele1());
    assertEquals("4", pedfd.getEntries(2, 4).get(1).getFamily());
    assertEquals(2.0, pedfd.getEntries(2, 4).get(1).getPhenotype());

    assertEquals('C', pedfd.getEntries(0, 6).get(4).getBialleles().get(0).getAllele1());
    assertEquals('C', pedfd.getEntries(1, 6).get(3).getBialleles().get(0).getAllele2());
    assertEquals('G', pedfd.getEntries(2, 6).get(2).getBialleles().get(1).getAllele1());
    assertEquals('T', pedfd.getEntries(3, 6).get(1).getBialleles().get(1).getAllele2());
  }