Example #1
0
  @Test
  public void testDebugPDBPolymer() {
    IPDBPolymer pdbPolymer = new DebugPDBPolymer();
    Assert.assertNotNull(pdbPolymer);
    Assert.assertEquals(pdbPolymer.getMonomerCount(), 0);

    IStrand oStrand1 = pdbPolymer.getBuilder().newInstance(IStrand.class);
    oStrand1.setStrandName("A");
    IStrand oStrand2 = pdbPolymer.getBuilder().newInstance(IStrand.class);
    oStrand2.setStrandName("B");
    IMonomer oMono1 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
    oMono1.setMonomerName(new String("TRP279"));
    IMonomer oMono2 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
    oMono2.setMonomerName(new String("HOH"));
    IMonomer oMono3 = pdbPolymer.getBuilder().newInstance(IMonomer.class);
    oMono3.setMonomerName(new String("GLYA16"));
    IPDBAtom oPDBAtom1 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C1");
    IPDBAtom oPDBAtom2 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C2");
    IPDBAtom oPDBAtom3 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C3");
    IPDBAtom oPDBAtom4 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C4");
    IPDBAtom oPDBAtom5 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C5");

    pdbPolymer.addAtom(oPDBAtom1);
    pdbPolymer.addAtom(oPDBAtom2, oStrand1);
    pdbPolymer.addAtom(oPDBAtom3, oMono1, oStrand1);
    pdbPolymer.addAtom(oPDBAtom4, oMono2, oStrand2);
    pdbPolymer.addAtom(oPDBAtom5, oMono3, oStrand2);
    Assert.assertNotNull(pdbPolymer.getAtom(0));
    Assert.assertNotNull(pdbPolymer.getAtom(1));
    Assert.assertNotNull(pdbPolymer.getAtom(2));
    Assert.assertNotNull(pdbPolymer.getAtom(3));
    Assert.assertNotNull(pdbPolymer.getAtom(4));
    Assert.assertEquals(oPDBAtom1, pdbPolymer.getAtom(0));
    Assert.assertEquals(oPDBAtom2, pdbPolymer.getAtom(1));
    Assert.assertEquals(oPDBAtom3, pdbPolymer.getAtom(2));
    Assert.assertEquals(oPDBAtom4, pdbPolymer.getAtom(3));
    Assert.assertEquals(oPDBAtom5, pdbPolymer.getAtom(4));

    Assert.assertNull(pdbPolymer.getMonomer("0815", "A"));
    Assert.assertNull(pdbPolymer.getMonomer("0815", "B"));
    Assert.assertNull(pdbPolymer.getMonomer("0815", ""));
    Assert.assertNull(pdbPolymer.getStrand(""));
    Assert.assertNotNull(pdbPolymer.getMonomer("TRP279", "A"));
    Assert.assertEquals(oMono1, pdbPolymer.getMonomer("TRP279", "A"));
    Assert.assertEquals(pdbPolymer.getMonomer("TRP279", "A").getAtomCount(), 1);
    Assert.assertNotNull(pdbPolymer.getMonomer("HOH", "B"));
    Assert.assertEquals(oMono2, pdbPolymer.getMonomer("HOH", "B"));
    Assert.assertEquals(pdbPolymer.getMonomer("HOH", "B").getAtomCount(), 1);
    Assert.assertEquals(pdbPolymer.getStrand("B").getAtomCount(), 2);
    Assert.assertEquals(pdbPolymer.getStrand("B").getMonomerCount(), 2);
    Assert.assertNull(pdbPolymer.getStrand("C"));
    Assert.assertNotNull(pdbPolymer.getStrand("B"));
  }
Example #2
0
  @Test
  public void testStrand() {
    IStrand oStrand = new Strand();
    Assert.assertNotNull(oStrand);
    Assert.assertEquals(oStrand.getMonomerCount(), 0);

    IMonomer oMono1 = oStrand.getBuilder().newInstance(IMonomer.class);
    oMono1.setMonomerName(new String("TRP279"));
    IMonomer oMono2 = oStrand.getBuilder().newInstance(IMonomer.class);
    oMono2.setMonomerName(new String("HOH"));
    IMonomer oMono3 = oStrand.getBuilder().newInstance(IMonomer.class);
    oMono3.setMonomerName(new String("GLYA16"));
    IAtom oAtom1 = oStrand.getBuilder().newInstance(IAtom.class, "C1");
    IAtom oAtom2 = oStrand.getBuilder().newInstance(IAtom.class, "C2");
    IAtom oAtom3 = oStrand.getBuilder().newInstance(IAtom.class, "C3");
    IAtom oAtom4 = oStrand.getBuilder().newInstance(IAtom.class, "C4");
    IAtom oAtom5 = oStrand.getBuilder().newInstance(IAtom.class, "C5");

    oStrand.addAtom(oAtom1);
    oStrand.addAtom(oAtom2);
    oStrand.addAtom(oAtom3, oMono1);
    oStrand.addAtom(oAtom4, oMono2);
    oStrand.addAtom(oAtom5, oMono3);
    Assert.assertNotNull(oStrand.getAtom(0));
    Assert.assertNotNull(oStrand.getAtom(1));
    Assert.assertNotNull(oStrand.getAtom(2));
    Assert.assertNotNull(oStrand.getAtom(3));
    Assert.assertNotNull(oStrand.getAtom(4));
    Assert.assertEquals(oAtom1, oStrand.getAtom(0));
    Assert.assertEquals(oAtom2, oStrand.getAtom(1));
    Assert.assertEquals(oAtom3, oStrand.getAtom(2));
    Assert.assertEquals(oAtom4, oStrand.getAtom(3));
    Assert.assertEquals(oAtom5, oStrand.getAtom(4));

    Assert.assertNull(oStrand.getMonomer("0815"));
    Assert.assertNotNull(oStrand.getMonomer(""));
    Assert.assertNotNull(oStrand.getMonomer("TRP279"));
    Assert.assertEquals(oMono1, oStrand.getMonomer("TRP279"));
    Assert.assertEquals(oStrand.getMonomer("TRP279").getAtomCount(), 1);
    Assert.assertNotNull(oStrand.getMonomer("HOH"));
    Assert.assertEquals(oMono2, oStrand.getMonomer("HOH"));
    Assert.assertEquals(oStrand.getMonomer("HOH").getAtomCount(), 1);
    Assert.assertEquals(oStrand.getMonomer("").getAtomCount(), 2);
    Assert.assertEquals(oStrand.getAtomCount(), 5);
    Assert.assertEquals(oStrand.getMonomerCount(), 3);
  }