Search in sources :

Example 1 with SymbolAndChargeQueryAtom

use of org.openscience.cdk.isomorphism.matchers.SymbolAndChargeQueryAtom in project cdk by cdk.

the class SMARTSTest method testMatchInherited.

@Test
public void testMatchInherited() {
    try {
        IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
        SymbolQueryAtom c1 = new SymbolQueryAtom(new org.openscience.cdk.Atom("C"));
        SymbolAndChargeQueryAtom c2 = new SymbolAndChargeQueryAtom(new org.openscience.cdk.Atom("C"));
        IAtomContainer c = TestMoleculeFactory.makeAlkane(2);
        QueryAtomContainer query1 = new QueryAtomContainer(builder);
        query1.addAtom(c1);
        query1.addAtom(c2);
        query1.addBond(new OrderQueryBond(c1, c2, Order.SINGLE, builder));
        Assert.assertTrue(uiTester.isSubgraph(c, query1));
        QueryAtomContainer query = new QueryAtomContainer(builder);
        query.addAtom(c1);
        query.addAtom(c2);
        query.addBond(new AnyOrderQueryBond(c1, c2, Order.SINGLE, builder));
        Assert.assertTrue(uiTester.isSubgraph(c, query));
    } catch (CDKException exception) {
        Assert.fail(exception.getMessage());
    }
}
Also used : AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) CDKException(org.openscience.cdk.exception.CDKException) AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) OrderQueryBond(org.openscience.cdk.isomorphism.matchers.OrderQueryBond) SymbolAndChargeQueryAtom(org.openscience.cdk.isomorphism.matchers.SymbolAndChargeQueryAtom) IChemObjectBuilder(org.openscience.cdk.interfaces.IChemObjectBuilder) QueryAtomContainer(org.openscience.cdk.isomorphism.matchers.QueryAtomContainer) SymbolQueryAtom(org.openscience.cdk.isomorphism.matchers.SymbolQueryAtom) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CDKException (org.openscience.cdk.exception.CDKException)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1 IChemObjectBuilder (org.openscience.cdk.interfaces.IChemObjectBuilder)1 OrderQueryBond (org.openscience.cdk.isomorphism.matchers.OrderQueryBond)1 QueryAtomContainer (org.openscience.cdk.isomorphism.matchers.QueryAtomContainer)1 SymbolAndChargeQueryAtom (org.openscience.cdk.isomorphism.matchers.SymbolAndChargeQueryAtom)1 SymbolQueryAtom (org.openscience.cdk.isomorphism.matchers.SymbolQueryAtom)1 AnyOrderQueryBond (org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond)1