Permalink
Browse files

Use 'aromatic' SMILES with CDKRest services (egonw++).

Also cleaned up deps.
  • Loading branch information...
1 parent f814a02 commit 950fdf580266524cfa3851464c5dbdbf88b3da01 @olas committed May 31, 2010
@@ -7,11 +7,13 @@ Bundle-Activator: net.bioclipse.cdk.qsar.rest.Activator
Bundle-Vendor: The Bioclipse Team
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- net.bioclipse.cdk.business;bundle-version="2.0.0",
- net.bioclipse.core;bundle-version="2.0.0",
- net.bioclipse.qsar;bundle-version="1.0.0",
- net.bioclipse.ui;bundle-version="2.0.0",
- net.bioclipse.xom;bundle-version="1.1.0"
+ net.bioclipse.cdk.business,
+ net.bioclipse.core,
+ net.bioclipse.qsar,
+ net.bioclipse.ui,
+ net.bioclipse.xom,
+ org.openscience.cdk.smiles,
+ org.openscience.cdk.interfaces
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.log4j
@@ -24,9 +24,12 @@
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.smiles.SmilesGenerator;
import net.bioclipse.cdk.business.Activator;
import net.bioclipse.cdk.business.ICDKManager;
+import net.bioclipse.cdk.domain.ICDKMolecule;
import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.core.domain.IMolecule;
import net.bioclipse.core.util.LogUtils;
@@ -96,7 +99,16 @@ public CdkRESTDescriptorCalculator() {
try {
//We need the SMILES for the REST descriptors
- String smiles=cdk.calculateSMILES( mol );
+ ICDKMolecule cdkMol = cdk.asCDKMolecule(mol);
+ IAtomContainer atomContainer = cdkMol.getAtomContainer();
+ SmilesGenerator generator = new SmilesGenerator(true);
+ org.openscience.cdk.interfaces.IMolecule molecule;
+ if (atomContainer instanceof org.openscience.cdk.interfaces.IMolecule) {
+ molecule = (org.openscience.cdk.interfaces.IMolecule)atomContainer;
+ } else {
+ molecule = atomContainer.getBuilder().newMolecule(atomContainer);
+ }
+ String smiles = generator.createSMILES(molecule);
List<IDescriptorResult> retlist=
new ArrayList<IDescriptorResult>();

0 comments on commit 950fdf5

Please sign in to comment.