示例#1
0
        public void TestIdenticalTypes()
        {
            var smiles1 = "CN(C)CCC1=CNC2=C1C=C(C=C2)CC1NC(=O)OC1";
            var smiles2 = "CN(C)CCC1=CNc2c1cc(cc2)CC1NC(=O)OC1";

            var mol1 = smilesParser.ParseSmiles(smiles1);
            var mol2 = smilesParser.ParseSmiles(smiles2);

            Assert.AreEqual(mol1.Atoms.Count, mol2.Atoms.Count);
            Assert.AreEqual(mol1.Bonds.Count, mol2.Bonds.Count);

            var types1 = atomTypeMatcher.FindMatchingAtomTypes(mol1).ToReadOnlyList();
            var types2 = atomTypeMatcher.FindMatchingAtomTypes(mol2).ToReadOnlyList();

            for (int i = 0; i < mol1.Atoms.Count; i++)
            {
                Assert.AreEqual(types1[i].AtomTypeName, types2[i].AtomTypeName);
            }
        }
示例#2
0
        private static void TypeAndRetype(string smiles)
        {
            var mol   = smilesParser.ParseSmiles(smiles);
            var types = atomTypeMatcher.FindMatchingAtomTypes(mol).ToReadOnlyList();

            for (int i = 0; i < types.Count; i++)
            {
                AtomTypeManipulator.Configure(mol.Atoms[i], types[i]);
            }
            var retyped = atomTypeMatcher.FindMatchingAtomTypes(mol).ToReadOnlyList();

            for (int i = 0; i < types.Count; i++)
            {
                Assert.AreEqual(types[i], retyped[i],
                                $"First perception resulted in {types[i]} but the second perception gave {retyped[i]}");
            }
            retyped = atomTypeMatcher.FindMatchingAtomTypes(mol).ToReadOnlyList();
            for (int i = 0; i < types.Count; i++)
            {
                Assert.AreEqual(types[i], retyped[i],
                                $"First perception resulted in {types[i]} but the third perception gave {retyped[i]}");
            }
        }