Hi,

I'm trying to search a substructure in a molecule by a given SMART  
pattern. So I searched for a java library which supports SMART  
patterns. CDK looks like a very professional framework, although I  
wish I could find a smaller library which just support SMART and not  
hundred features more ^^

Nevertheless, I include the cdk jar file and try following code:

Mol2Reader mr = new Mol2Reader(new FileReader(new File(filename)));
final IMolecule molecule = (IMolecule)mr.read(new Molecule());
final QueryAtomContainer query = SMARTSParser.parse("[#8]");
final boolean b = UniversalIsomorphismTester.isSubgraph(molecule, query);
System.out.println(b); // true

It works. Next I changed the pattern into "[#8D2]". Now following  
error message occurs:

Exception in thread "main" java.lang.NullPointerException
     at  
org.openscience.cdk.isomorphism.matchers.smarts.ExplicitConnectionAtom.matches(ExplicitConnectionAtom.java:60)
     at  
org.openscience.cdk.isomorphism.matchers.smarts.LogicalOperatorAtom.matches(LogicalOperatorAtom.java:82)
     at  
org.openscience.cdk.isomorphism.UniversalIsomorphismTester.isSubgraph(UniversalIsomorphismTester.java:337)
     at TestMol2.main(TestMol2.java:33)

I looked in the source code and find following:
atom.getProperty(CDKConstants.TOTAL_CONNECTIONS)

This property isn't defined in my atoms. In fact, there are no  
properties defined in my atoms. So how can I load atoms which full  
property sets so that substructure search works properly?

I thank you very much in advance,
Kai




------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to