예제 #1
0
        public void TestGetOverlaps_IAtomContainer_IAtomContainer()
        {
            var file1 = "NCDK.Data.MDL.5SD.mol";
            var file2 = "NCDK.Data.MDL.ADN.mol";
            var mol1  = builder.NewAtomContainer();
            var mol2  = builder.NewAtomContainer();

            var ins1 = ResourceLoader.GetAsStream(file1);

            new MDLV2000Reader(ins1, ChemObjectReaderMode.Strict).Read(mol1);
            var ins2 = ResourceLoader.GetAsStream(file2);

            new MDLV2000Reader(ins2, ChemObjectReaderMode.Strict).Read(mol2);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            var adder = CDK.HydrogenAdder;

            adder.AddImplicitHydrogens(mol1);
            Aromaticity.CDKLegacy.Apply(mol1);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);
            adder = CDK.HydrogenAdder;
            adder.AddImplicitHydrogens(mol2);
            Aromaticity.CDKLegacy.Apply(mol2);

            var list = CDKMCS.GetOverlaps(mol1, mol2, true);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(11, list[0].Atoms.Count);

            list = CDKMCS.GetOverlaps(mol2, mol1, true);
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(11, list[0].Atoms.Count);
        }
예제 #2
0
        public void TestSFBug999330()
        {
            var file1 = "NCDK.Data.MDL.5SD.mol";
            var file2 = "NCDK.Data.MDL.ADN.mol";
            var mol1  = builder.NewAtomContainer();
            var mol2  = builder.NewAtomContainer();

            var ins1 = ResourceLoader.GetAsStream(file1);

            new MDLV2000Reader(ins1, ChemObjectReaderMode.Strict).Read(mol1);
            var ins2 = ResourceLoader.GetAsStream(file2);

            new MDLV2000Reader(ins2, ChemObjectReaderMode.Strict).Read(mol2);
            var permutor = new AtomContainerAtomPermutor(mol2);

            permutor.MoveNext();
            mol2 = builder.NewAtomContainer(permutor.Current);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            var adder = CDK.HydrogenAdder;

            adder.AddImplicitHydrogens(mol1);
            Aromaticity.CDKLegacy.Apply(mol1);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);
            adder = CDK.HydrogenAdder;
            adder.AddImplicitHydrogens(mol2);
            Aromaticity.CDKLegacy.Apply(mol2);

            var list1 = CDKMCS.GetOverlaps(mol1, mol2, true);
            var list2 = CDKMCS.GetOverlaps(mol2, mol1, true);

            Assert.AreEqual(1, list1.Count);
            Assert.AreEqual(1, list2.Count);
            Assert.AreEqual(list1[0].Atoms.Count, list2[0].Atoms.Count);
        }