Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCS Code not working with CDK 2.x #9

Open
tdudgeon opened this issue Aug 14, 2019 · 0 comments
Open

MCS Code not working with CDK 2.x #9

tdudgeon opened this issue Aug 14, 2019 · 0 comments

Comments

@tdudgeon
Copy link

I tried to get the MCS search running using the latest CDK 2.3 based on code here: https://github.com/asad/SMSD/blob/master/core/src/test/java/example/MCSSearch.java

I hit a problem. Code is essentially like this:

        IAtomContainer query = ChemUtils.generate2D(smilesParser.parseSmiles('NC1=CC=CC=C1'))
        IAtomContainer target = ChemUtils.generate2D(smilesParser.parseSmiles('NC1=CC(=CC=C1)C(O)=O'))

        ExtAtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(query);
        ExtAtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(target);

        query = ExtAtomContainerManipulator.removeHydrogens(query);
        target = ExtAtomContainerManipulator.removeHydrogens(target);

        ExtAtomContainerManipulator.aromatizeMolecule(query);
        ExtAtomContainerManipulator.aromatizeMolecule(target);

        query = new AtomContainer(query);
        target = new AtomContainer(target);

        boolean bondSensitive = true;
        boolean ringMatch = false;
        boolean stereoMatch = true;
        boolean fragmentMinimization = true;
        boolean energyMinimization = true;

        Isomorphism comparison = new Isomorphism(query, target, Algorithm.DEFAULT, bondSensitive, ringMatch, false);
        comparison.setChemFilters(stereoMatch, fragmentMinimization, energyMinimization);
        AtomAtomMapping firstAtomMapping = comparison.getFirstAtomMapping();

The problem comes from the line comparison.setChemFilters(stereoMatch, fragmentMinimization, energyMinimization)

java.lang.IllegalArgumentException: setFlag() must be provided a valid CDKConstant and not used for custom properties
	at org.openscience.cdk.silent.ChemObject.setFlag(ChemObject.java:315)
	at org.openscience.cdk.ChemObjectRef.setFlag(ChemObjectRef.java:168)
	at org.openscience.cdk.AtomRef.setFlag(AtomRef.java:40)
	at org.openscience.smsd.filters.EnergyFilter.getMappedMoleculeEnergies(EnergyFilter.java:109)
	at org.openscience.smsd.filters.EnergyFilter.sortResults(EnergyFilter.java:62)
	at org.openscience.smsd.filters.EnergyFilter.sortResults(EnergyFilter.java:44)
	at org.openscience.smsd.filters.ChemicalFilters.sortResultsByEnergies(ChemicalFilters.java:105)
	at org.openscience.smsd.BaseMapping.setChemFilters(BaseMapping.java:95)

Looks like something in the CDK API has changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant