示例#1
0
        public void RecogniseLeftHandedGlyceraldehyde()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 0, 0.80d, 1.24d));
            m.Atoms.Add(Atom("C", 0, 0.80d, 0.42d));
            m.Atoms.Add(Atom("O", 1, 0.09d, 1.66d));
            m.Atoms.Add(Atom("O", 0, 1.52d, 1.66d));
            m.Atoms.Add(Atom("O", 0, -0.02d, 0.42d));
            m.Atoms.Add(Atom("C", 2, 0.80d, -0.41d));
            m.Atoms.Add(Atom("H", 1, 1.63d, 0.42d));
            m.Atoms.Add(Atom("O", 1, 1.52d, -0.82d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[3], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[1], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[7], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][]            graph      = GraphUtil.ToAdjList(m, bondMap);
            FischerRecognition recogniser = new FischerRecognition(m,
                                                                   graph,
                                                                   bondMap,
                                                                   Stereocenters.Of(m));
            var elements = recogniser.Recognise(new[] { Projection.Fischer }).ToReadOnlyList();

            Assert.AreEqual(1, elements.Count);
            AssertTetrahedralCenter(elements[0],
                                    m.Atoms[1],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[0], m.Atoms[6], m.Atoms[5], m.Atoms[4]);
        }
示例#2
0
        public void Mannitol()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 2, -0.53d, 6.25d));
            m.Atoms.Add(Atom("C", 1, -0.53d, 5.42d));
            m.Atoms.Add(Atom("O", 1, 0.18d, 6.66d));
            m.Atoms.Add(Atom("O", 1, -1.36d, 5.42d));
            m.Atoms.Add(Atom("C", 1, -0.53d, 4.60d));
            m.Atoms.Add(Atom("O", 1, -1.36d, 4.60d));
            m.Atoms.Add(Atom("C", 1, -0.53d, 3.77d));
            m.Atoms.Add(Atom("O", 1, 0.29d, 3.77d));
            m.Atoms.Add(Atom("C", 1, -0.53d, 2.95d));
            m.Atoms.Add(Atom("O", 1, 0.29d, 2.95d));
            m.Atoms.Add(Atom("C", 2, -0.53d, 2.12d));
            m.Atoms.Add(Atom("O", 1, 0.05d, 1.54d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[6], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[6], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[10], BondOrder.Single);
            m.AddBond(m.Atoms[10], m.Atoms[11], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][]            graph      = GraphUtil.ToAdjList(m, bondMap);
            FischerRecognition recogniser = new FischerRecognition(m,
                                                                   graph,
                                                                   bondMap,
                                                                   Stereocenters.Of(m));
            var elements = recogniser.Recognise(new[] { Projection.Fischer }).ToReadOnlyList();

            Assert.AreEqual(4, elements.Count);
            AssertTetrahedralCenter(elements[0],
                                    m.Atoms[1],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[0], m.Atoms[1], m.Atoms[4], m.Atoms[3]);
            AssertTetrahedralCenter(elements[1],
                                    m.Atoms[4],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[1], m.Atoms[4], m.Atoms[6], m.Atoms[5]);
            AssertTetrahedralCenter(elements[2],
                                    m.Atoms[6],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[4], m.Atoms[7], m.Atoms[8], m.Atoms[6]);
            AssertTetrahedralCenter(elements[3],
                                    m.Atoms[8],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[6], m.Atoms[9], m.Atoms[10], m.Atoms[8]);

            m.SetStereoElements(elements);
        }
示例#3
0
        public void HorizontalBondsMustBeTerminal()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 0, 12.71d, -16.51d));
            m.Atoms.Add(Atom("C", 1, 12.30d, -17.22d));
            m.Atoms.Add(Atom("C", 1, 11.47d, -17.22d));
            m.Atoms.Add(Atom("C", 1, 11.06d, -16.51d));
            m.Atoms.Add(Atom("C", 1, 11.47d, -15.79d));
            m.Atoms.Add(Atom("C", 1, 12.30d, -15.79d));
            m.Atoms.Add(Atom("O", 1, 13.54d, -17.33d));
            m.Atoms.Add(Atom("C", 0, 13.54d, -16.51d));
            m.Atoms.Add(Atom("C", 0, 14.36d, -16.51d));
            m.Atoms.Add(Atom("O", 1, 14.77d, -17.22d));
            m.Atoms.Add(Atom("O", 0, 14.77d, -15.79d));
            m.Atoms.Add(Atom("C", 3, 13.54d, -15.68d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[5], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[1], m.Atoms[2], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[2], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[4], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[4], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[7], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[7], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[10], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[0], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[11], m.Atoms[7], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][]            graph      = GraphUtil.ToAdjList(m, bondMap);
            FischerRecognition recogniser = new FischerRecognition(m,
                                                                   graph,
                                                                   bondMap,
                                                                   Stereocenters.Of(m));

            Assert.IsTrue(recogniser.Recognise(new[] { Projection.Fischer }).Count() == 0);
        }
示例#4
0
        public void IgnoreCyclicStereocenters()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 0, 6.87d, -5.59d));
            m.Atoms.Add(Atom("C", 0, 6.87d, -6.61d));
            m.Atoms.Add(Atom("C", 0, 7.82d, -5.62d));
            m.Atoms.Add(Atom("C", 0, 6.87d, -4.59d));
            m.Atoms.Add(Atom("O", 0, 8.18d, -6.34d));
            m.Atoms.Add(Atom("C", 0, 7.62d, -6.91d));
            m.Atoms.Add(Atom("C", 0, 5.90d, -5.59d));
            m.Atoms.Add(Atom("C", 0, 8.39d, -5.06d));
            m.Atoms.Add(Atom("C", 0, 5.60d, -4.80d));
            m.Atoms.Add(Atom("C", 2, 6.16d, -4.24d));
            m.Atoms.Add(Atom("O", 0, 8.22d, -4.29d));
            m.Atoms.Add(Atom("C", 2, 6.10d, -6.90d));
            m.Atoms.Add(Atom("C", 2, 5.54d, -6.29d));
            m.Atoms.Add(Atom("C", 2, 7.46d, -4.07d));
            m.Atoms.Add(Atom("O", 0, 7.79d, -7.72d));
            m.Atoms.Add(Atom("O", 0, 9.18d, -5.29d));
            m.Atoms.Add(Atom("O", 1, 6.87d, -7.44d));
            m.Atoms.Add(Atom("C", 3, 6.76d, -3.77d));
            m.Atoms.Add(Atom("C", 3, 4.82d, -5.07d));
            m.Atoms.Add(Atom("C", 3, 5.19d, -4.08d));
            m.Atoms.Add(Atom("H", 0, 8.64d, -5.76d));
            m.Atoms.Add(Atom("H", 0, 5.08d, -5.69d));
            m.AddBond(m.Atoms[1], m.Atoms[0], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[0], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[7], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[9], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[10], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[11], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[12], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[13], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[14], m.Atoms[5], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[15], m.Atoms[7], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[1], m.Atoms[16], BondOrder.Single, BondStereo.Up);
            m.AddBond(m.Atoms[3], m.Atoms[17], BondOrder.Single, BondStereo.Up);
            m.AddBond(m.Atoms[18], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[19], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[20], BondOrder.Single, BondStereo.Down);
            m.AddBond(m.Atoms[6], m.Atoms[21], BondOrder.Single, BondStereo.Down);
            m.AddBond(m.Atoms[5], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[11], m.Atoms[12], BondOrder.Single);
            m.AddBond(m.Atoms[10], m.Atoms[13], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[9], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][]            graph      = GraphUtil.ToAdjList(m, bondMap);
            FischerRecognition recogniser = new FischerRecognition(m,
                                                                   graph,
                                                                   bondMap,
                                                                   Stereocenters.Of(m));

            Assert.IsTrue(recogniser.Recognise(new[] { Projection.Fischer }).Count() == 0);
        }