Hi John,

Yes, turning off AtomContainer2 avoids the error.


On 27/08/2019 16:31, John Mayfield wrote:
Hmm odd, in legacy so expected but tests seem okay. Can you try turning off AtomContainer2, https://github.com/cdk/cdk/wiki/AtomContainer2

On Tue, 27 Aug 2019 at 14:19, Tim Dudgeon <[email protected] <mailto:[email protected]>> wrote:

    Hi folks,

    I'm getting a NPE from AtomAtomMapping.getCommonFragmentAsSMILES()
    in certain cases.
    An example is below - the two structures differ only for a Cl <->
    Br change.

    This is using the org.openscience.smsd.AtomAtomMapping,
    org.openscience.smsd.Isomorphism and
    org.openscience.smsd.tools.ExtAtomContainerManipulator classes.
    Not sure if those guys are active on this list?


    IAtomContainer query =smilesParser.parseSmiles('BrC1CCC(Cc2ccccc2)C1')
    IAtomContainer target =smilesParser.parseSmiles('ClC1CCC(Cc2ccccc2)C1')

    StructureDiagramGenerator sdg =new StructureDiagramGenerator()
    sdg.generateCoordinates(query)

    ExtAtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(query)
    ExtAtomContainerManipulator.aromatizeMolecule(query)

    ExtAtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(target)
    ExtAtomContainerManipulator.aromatizeMolecule(target)

    Isomorphism comparison =new Isomorphism(query, target, 
Algorithm.DEFAULT,true,false,false)
    AtomAtomMapping mapping = comparison.getFirstAtomMapping()

    String mcsSmiles = mapping.getCommonFragmentAsSMILES()

    The error I get is:

    java.lang.NullPointerException
        at
    
org.openscience.cdk.silent.AtomContainer2.getAtomRefUnsafe(AtomContainer2.java:172)
        at
    org.openscience.cdk.silent.AtomContainer2.getBond(AtomContainer2.java:612)
        at
    
org.openscience.smsd.AtomAtomMapping.getCommonFragment(AtomAtomMapping.java:332)
        at
    
org.openscience.smsd.AtomAtomMapping.getCommonFragmentAsSMILES(AtomAtomMapping.java:371)
        at
    
org.squonk.fragnet.depict.ChemUtilsSpec.alignMolecule2(ChemUtilsSpec.groovy:81)




    _______________________________________________
    Cdk-user mailing list
    [email protected] <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/cdk-user

_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to