Navigation Menu

Skip to content

Commit

Permalink
Use Kevin's double bond location finder in the cdk.fromSMILES() method
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Jun 21, 2012
1 parent e8aecb5 commit 8f2097d
Showing 1 changed file with 11 additions and 3 deletions.
Expand Up @@ -149,6 +149,7 @@
import org.openscience.cdk.silent.SilentChemObjectBuilder;
import org.openscience.cdk.similarity.Tanimoto;
import org.openscience.cdk.smiles.DeduceBondSystemTool;
import org.openscience.cdk.smiles.FixBondOrdersTool;
import org.openscience.cdk.smiles.SmilesGenerator;
import org.openscience.cdk.smiles.SmilesParser;
import org.openscience.cdk.smiles.smarts.SMARTSQueryTool;
Expand Down Expand Up @@ -969,6 +970,8 @@ public void saveMolecules( List<? extends IMolecule> molecules,
}
}

private FixBondOrdersTool fbot = new FixBondOrdersTool();

/**
* Create molecule from SMILES.
*
Expand All @@ -980,14 +983,19 @@ public ICDKMolecule fromSMILES(String smilesDescription)
SmilesParser parser
= new SmilesParser( DefaultChemObjectBuilder.getInstance() );

org.openscience.cdk.interfaces.IMolecule molecule;
try {
org.openscience.cdk.interfaces.IMolecule mol
= parser.parseSmiles(smilesDescription);
return new CDKMolecule(mol);
molecule = parser.parseSmiles(smilesDescription);
}
catch (InvalidSmilesException e) {
throw new BioclipseException("SMILES string is invalid. Error message said: " + e.getMessage(), e);
}
try {
fbot.kekuliseAromaticRings(molecule);
} catch (CDKException exception) {
logger.warn("Could not figure out the double bond positions: " + exception.getMessage());
}
return new CDKMolecule(molecule);
}

/**
Expand Down

0 comments on commit 8f2097d

Please sign in to comment.