Search in sources :

Example 1 with ImplicitHCountAtom

use of org.openscience.cdk.isomorphism.matchers.smarts.ImplicitHCountAtom in project cdk by cdk.

the class SMARTSTest method testImplicitHCountAtom.

@Test
public void testImplicitHCountAtom() throws Exception {
    IAtomContainer container = createEthane();
    IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
    // SMARTS [h3][h3]
    QueryAtomContainer query1 = new QueryAtomContainer(builder);
    SMARTSAtom atom1 = new ImplicitHCountAtom(3, builder);
    SMARTSAtom atom2 = new ImplicitHCountAtom(3, builder);
    query1.addAtom(atom1);
    query1.addAtom(atom2);
    query1.addBond(new OrderQueryBond(atom1, atom2, IBond.Order.SINGLE, builder));
    Assert.assertTrue(uiTester.isSubgraph(container, query1));
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) SMARTSAtom(org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom) AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) OrderQueryBond(org.openscience.cdk.isomorphism.matchers.OrderQueryBond) IChemObjectBuilder(org.openscience.cdk.interfaces.IChemObjectBuilder) QueryAtomContainer(org.openscience.cdk.isomorphism.matchers.QueryAtomContainer) ImplicitHCountAtom(org.openscience.cdk.isomorphism.matchers.smarts.ImplicitHCountAtom) Test(org.junit.Test)

Example 2 with ImplicitHCountAtom

use of org.openscience.cdk.isomorphism.matchers.smarts.ImplicitHCountAtom in project cdk by cdk.

the class SMARTSTest method testImplicitHCountAtom2.

@Test
public void testImplicitHCountAtom2() throws Exception {
    IAtomContainer container = createEthane();
    IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
    // SMARTS [h3][h2]
    QueryAtomContainer query1 = new QueryAtomContainer(builder);
    SMARTSAtom atom1 = new ImplicitHCountAtom(3, builder);
    SMARTSAtom atom2 = new ImplicitHCountAtom(2, builder);
    query1.addAtom(atom1);
    query1.addAtom(atom2);
    query1.addBond(new OrderQueryBond(atom1, atom2, IBond.Order.SINGLE, builder));
    Assert.assertFalse(uiTester.isSubgraph(container, query1));
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) SMARTSAtom(org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom) AnyOrderQueryBond(org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond) OrderQueryBond(org.openscience.cdk.isomorphism.matchers.OrderQueryBond) IChemObjectBuilder(org.openscience.cdk.interfaces.IChemObjectBuilder) QueryAtomContainer(org.openscience.cdk.isomorphism.matchers.QueryAtomContainer) ImplicitHCountAtom(org.openscience.cdk.isomorphism.matchers.smarts.ImplicitHCountAtom) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)2 IChemObjectBuilder (org.openscience.cdk.interfaces.IChemObjectBuilder)2 OrderQueryBond (org.openscience.cdk.isomorphism.matchers.OrderQueryBond)2 QueryAtomContainer (org.openscience.cdk.isomorphism.matchers.QueryAtomContainer)2 AnyOrderQueryBond (org.openscience.cdk.isomorphism.matchers.smarts.AnyOrderQueryBond)2 ImplicitHCountAtom (org.openscience.cdk.isomorphism.matchers.smarts.ImplicitHCountAtom)2 SMARTSAtom (org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom)2