Diff of /cdk-qa/trunk/projects/080813-00001/extractCDKmol2AtomTypes.bsh [000000] .. [r12013]  Maximize  Restore

Switch to side-by-side view

--- a
+++ b/cdk-qa/trunk/projects/080813-00001/extractCDKmol2AtomTypes.bsh
@@ -0,0 +1,35 @@
+#!/usr/bin/bsh
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
+import org.openscience.cdk.CDKConstants;
+import org.openscience.cdk.DefaultChemObjectBuilder;
+import org.openscience.cdk.atomtype.SybylAtomTypeMatcher;
+import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomType;
+import org.openscience.cdk.interfaces.IMolecule;
+import org.openscience.cdk.io.iterator.IteratingMDLReader;
+
+SybylAtomTypeMatcher matcher = SybylAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance());
+File file = new File("10_p0.1.sdf");
+IteratingMDLReader reader = new IteratingMDLReader(
+  new FileInputStream(file), DefaultChemObjectBuilder.getInstance()
+);
+int counter = 0;
+while (reader.hasNext() && counter < 1000) {
+  IMolecule molecule = (IMolecule)reader.next();
+  print(molecule.getProperty(CDKConstants.TITLE));
+  Iterator atoms = molecule.atoms();
+  while (atoms.hasNext()) {
+    IAtom atom = (IAtom)atoms.next();
+    try {
+      IAtomType type = matcher.findMatchingAtomType(molecule, atom);
+      print(type.getAtomTypeName());
+    } catch (Exception exception) {
+      print("null");
+    }
+  }
+  counter++;
+}
+print("\n");

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks