Navigation Menu

Skip to content

Commit

Permalink
Added a method to generate tautomers
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Aug 16, 2012
1 parent cfb29f6 commit 5c1c645
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/net.bioclipse.cdk.business/META-INF/MANIFEST.MF
Expand Up @@ -41,7 +41,8 @@ Require-Bundle: org.openscience.cdk.io,
net.bioclipse.inchi,
net.bioclipse.ui.business,
net.sf.cglib,
org.openscience.cdk.silent;bundle-version="1.4.10"
org.openscience.cdk.silent;bundle-version="1.4.10",
org.openscience.cdk.tautomer
Bundle-ActivationPolicy: lazy
Export-Package: net.bioclipse.cdk.business,
net.bioclipse.cdk.domain,
Expand Down
Expand Up @@ -154,6 +154,7 @@
import org.openscience.cdk.smiles.SmilesParser;
import org.openscience.cdk.smiles.smarts.SMARTSQueryTool;
import org.openscience.cdk.smiles.smarts.parser.TokenMgrError;
import org.openscience.cdk.tautomers.InChITautomerGenerator;
import org.openscience.cdk.tools.CDKHydrogenAdder;
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;
Expand Down Expand Up @@ -3160,6 +3161,33 @@ public List<ICDKMolecule> kabsch(List<IMolecule> molecules,
return results;
}

public List<ICDKMolecule> getTautomers(IMolecule molecule, IProgressMonitor monitor)
throws BioclipseException {
if (monitor == null) monitor = new NullProgressMonitor();

monitor.beginTask("Generating tautomers...", 100); // we won't get more than that, I guess
InChITautomerGenerator tautomerGenerator = new InChITautomerGenerator();
monitor.worked(1); // a bonus point for just starting

ICDKMolecule cdkMol = asCDKMolecule(molecule);
try {
List<IAtomContainer> tautomers = tautomerGenerator.getTautomers(cdkMol.getAtomContainer());
List<ICDKMolecule> tautomerList = new ArrayList<ICDKMolecule>();

for (IAtomContainer tautomer : tautomers) {
tautomerList.add(newMolecule(tautomer));
monitor.worked(1);
}
monitor.done();
return tautomerList;
} catch (Exception exception) {
throw new BioclipseException(
"Error while generating tautomers: " + exception.getMessage(),
exception
);
}
}

/**
* Split a list of mols in N equally sized parts by random sampling.
*
Expand Down
Expand Up @@ -1196,4 +1196,11 @@ public List<ICDKMolecule> loadSMILESFile( IFile file,
public void appendToSDF( String sdFile, ICDKMolecule molecule ) throws BioclipseException;

public void appendToSDF( IFile sdFile, ICDKMolecule molecule ) throws BioclipseException;

@Recorded
@PublishedMethod(
params="IMolecule molecule",
methodSummary="Generates a list of tautomers."
)
public List<ICDKMolecule> getTautomers(IMolecule molecule) throws BioclipseException;
}

0 comments on commit 5c1c645

Please sign in to comment.