/** * Removes the conformer at the specified position. * * @param i The position in the list to remove * @return The conformer that was at the specified position */ @Override public IAtomContainer remove(int i) { IAtomContainer oldAtomContainer = get(i); coordinates.remove(i); return oldAtomContainer; }
@Override public IAtomContainer set(int i, IAtomContainer atomContainer) { if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); Point3d[] tmp = getCoordinateList(atomContainer); IAtomContainer oldAtomContainer = get(i); coordinates.set(i, tmp); return oldAtomContainer; }
/** * Removes the conformer at the specified position. * * @param i The position in the list to remove * @return The conformer that was at the specified position */ @Override public IAtomContainer remove(int i) { IAtomContainer oldAtomContainer = get(i); coordinates.remove(i); return oldAtomContainer; }
@Override public IAtomContainer set(int i, IAtomContainer atomContainer) { if (!title.equals(atomContainer.getTitle())) throw new IllegalArgumentException( "The input molecules does not have the same title as the other conformers"); Point3d[] tmp = getCoordinateList(atomContainer); IAtomContainer oldAtomContainer = get(i); coordinates.set(i, tmp); return oldAtomContainer; }
@Test(expected = IndexOutOfBoundsException.class) public void testGet_int() { ConformerContainer container = new ConformerContainer(confs); container.get(100); }
@Test(expected = IndexOutOfBoundsException.class) public void testGet2() { ConformerContainer container = new ConformerContainer(confs); for (int i = 0; i < container.size() + 1; i++) container.get(i); }
@Test public void testContains() { ConformerContainer container = new ConformerContainer(confs); IAtomContainer o = container.get(0); Assert.assertTrue(container.contains(o)); }
@Test public void testIndexOf_IAtomContainer() { ConformerContainer container = new ConformerContainer(confs); IAtomContainer ac = container.get(2); int index = container.indexOf(ac); Assert.assertEquals(2, index); }
@Test public void testContains_Object() { ConformerContainer container = new ConformerContainer(confs); Assert.assertEquals(nconfs, container.size()); Assert.assertTrue(container.contains(container.get(3))); }
@Test public void testAddAll_Collection() { ConformerContainer container = new ConformerContainer(confs); Assert.assertEquals(nconfs, container.size()); Assert.assertTrue(container.contains(container.get(3))); }
query.addBond(b3); IAtomContainer conf1 = conformers.get(0); PharmacophoreMatcher matcher = new PharmacophoreMatcher(query); boolean status = matcher.matches(conf1);
@Test public void testRemove_Object() { ConformerContainer cContainer = new ConformerContainer(confs); Assert.assertEquals(nconfs, cContainer.size()); IAtomContainer container = cContainer.get(3); Assert.assertTrue(cContainer.contains(container)); cContainer.remove(container); Assert.assertEquals(nconfs - 1, cContainer.size()); Assert.assertFalse(cContainer.contains(container)); }
@Test public void testMatchedAtoms() throws Exception { Assert.assertNotNull(conformers); // make a query PharmacophoreQuery query = new PharmacophoreQuery(); PharmacophoreQueryAtom o = new PharmacophoreQueryAtom("D", "[OX1]"); PharmacophoreQueryAtom n1 = new PharmacophoreQueryAtom("A", "[N]"); PharmacophoreQueryAtom n2 = new PharmacophoreQueryAtom("A", "[N]"); query.addAtom(o); query.addAtom(n1); query.addAtom(n2); PharmacophoreQueryBond b1 = new PharmacophoreQueryBond(o, n1, 4.0, 4.5); PharmacophoreQueryBond b2 = new PharmacophoreQueryBond(o, n2, 4.0, 5.0); PharmacophoreQueryBond b3 = new PharmacophoreQueryBond(n1, n2, 5.4, 5.8); query.addBond(b1); query.addBond(b2); query.addBond(b3); IAtomContainer conf1 = conformers.get(0); PharmacophoreMatcher matcher = new PharmacophoreMatcher(query); boolean status = matcher.matches(conf1); Assert.assertTrue(status); List<List<PharmacophoreAtom>> pmatches = matcher.getMatchingPharmacophoreAtoms(); Assert.assertEquals(2, pmatches.size()); List<List<PharmacophoreAtom>> upmatches = matcher.getUniqueMatchingPharmacophoreAtoms(); Assert.assertEquals(1, upmatches.size()); }
@Test(expected = CDKException.class) public void testInvalidQuery() throws CDKException { PharmacophoreQuery query = new PharmacophoreQuery(); PharmacophoreQueryAtom o = new PharmacophoreQueryAtom("D", "[OX1]"); PharmacophoreQueryAtom n1 = new PharmacophoreQueryAtom("A", "[N]"); PharmacophoreQueryAtom n2 = new PharmacophoreQueryAtom("A", "[NX3]"); query.addAtom(o); query.addAtom(n1); query.addAtom(n2); PharmacophoreQueryBond b1 = new PharmacophoreQueryBond(o, n1, 4.0, 4.5); PharmacophoreQueryBond b2 = new PharmacophoreQueryBond(o, n2, 4.0, 5.0); PharmacophoreQueryBond b3 = new PharmacophoreQueryBond(n1, n2, 5.4, 5.8); query.addBond(b1); query.addBond(b2); query.addBond(b3); PharmacophoreMatcher matcher = new PharmacophoreMatcher(query); matcher.matches(conformers.get(0)); }