コード例 #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 RequireAtLeastTwoProjectedSubstituents()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("O", 0, -0.71d, 1.24d));
            m.Atoms.Add(Atom("C", 0, 0.00d, 0.83d));
            m.Atoms.Add(Atom("O", 0, 0.71d, 1.24d));
            m.Atoms.Add(Atom("C", 1, 0.00d, 0.00d));
            m.Atoms.Add(Atom("C", 2, -0.67d, -0.48d));
            m.Atoms.Add(Atom("C", 2, -0.41d, -1.27d));
            m.Atoms.Add(Atom("C", 2, 0.41d, -1.27d));
            m.Atoms.Add(Atom("N", 1, 0.67d, -0.48d));
            m.AddBond(m.Atoms[6], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[0], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[2], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[6], m.Atoms[7], BondOrder.Single);
            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

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

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            var elements = recon.Recognise(new[] { Projection.Haworth }).ToReadOnlyList();

            Assert.IsTrue(elements.Count == 0);
        }
コード例 #3
0
ファイル: Stereocenters.cs プロジェクト: roddickchen/NCDK
        /// <summary>
        /// Determine the stereocenter atoms in the provided container based on connectivity.
        /// </summary>
        /// <example>
        /// <include file='IncludeExamples.xml' path='Comments/Codes[@id="NCDK.Stereo.Stereocenters_Example.cs+Of"]/*' />
        /// </example>
        /// <param name="container">input container</param>
        /// <returns>the stereocenters</returns>
        public static Stereocenters Of(IAtomContainer container)
        {
            var bondMap       = EdgeToBondMap.WithSpaceFor(container);
            var g             = GraphUtil.ToAdjList(container, bondMap);
            var stereocenters = new Stereocenters(container, g, bondMap);

            stereocenters.CheckSymmetry();
            return(stereocenters);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: StereocentersTest.cs プロジェクト: roddickchen/NCDK
 // check if the first atom of the container is accepted
 static void Test(IAtomContainer container, CoordinateType type, string mesg, bool hnorm)
 {
     Assert.AreEqual(type, Stereocenters.Of(container).ElementType(0), mesg);
     if (hnorm)
     {
         AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(container);
         Assert.AreEqual(type, Stereocenters.Of(container).ElementType(0), mesg + " (unsupressed hydrogens)");
     }
 }
コード例 #6
0
 /// <summary>
 /// Required information to recognise stereochemistry.
 /// </summary>
 /// <param name="container">input structure</param>
 /// <param name="graph">adjacency list representation</param>
 /// <param name="bonds">edge to bond index</param>
 /// <param name="stereocenters">location and type of asymmetries</param>
 public FischerRecognition(IAtomContainer container,
                           int[][] graph,
                           EdgeToBondMap bonds,
                           Stereocenters stereocenters)
 {
     this.container     = container;
     this.graph         = graph;
     this.bonds         = bonds;
     this.stereocenters = stereocenters;
 }
コード例 #7
0
        static void Main()
        {
            IAtomContainer someContainer = null;

            #region Of
            IAtomContainer container = someContainer;
            Stereocenters  centers   = Stereocenters.Of(container);
            for (int i = 0; i < container.Atoms.Count; i++)
            {
                if (centers.IsStereocenter(i))
                {
                }
            }
            #endregion
        }
コード例 #8
0
        public void Hexopyranose()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("O", 1, 0.00d, 2.48d));
            m.Atoms.Add(Atom("C", 2, 0.71d, 2.06d));
            m.Atoms.Add(Atom("C", 1, 0.71d, 1.24d));
            m.Atoms.Add(Atom("O", 0, 1.43d, 0.82d));
            m.Atoms.Add(Atom("C", 1, 1.43d, -0.00d));
            m.Atoms.Add(Atom("O", 1, 2.14d, -0.41d));
            m.Atoms.Add(Atom("C", 1, 0.71d, -0.41d));
            m.Atoms.Add(Atom("O", 1, 0.71d, -1.24d));
            m.Atoms.Add(Atom("C", 1, -0.00d, 0.00d));
            m.Atoms.Add(Atom("O", 1, -0.71d, -0.41d));
            m.Atoms.Add(Atom("C", 1, 0.00d, 0.83d));
            m.Atoms.Add(Atom("O", 1, -0.71d, 1.24d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], 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[2], 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);

            Stereocenters stereocenters = new Stereocenters(m, graph, bondMap);

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            Assert.IsTrue(recon.Recognise(new[] { Projection.Haworth }).Count() == 0);
        }
コード例 #9
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);
        }
コード例 #10
0
        public void HaworthFalsePositive()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 2, -0.71d, 0.41d));
            m.Atoms.Add(Atom("C", 2, 0.71d, -0.41d));
            m.Atoms.Add(Atom("C", 2, 0.71d, 0.41d));
            m.Atoms.Add(Atom("C", 2, -0.71d, -0.41d));
            m.Atoms.Add(Atom("C", 1, 0.00d, 0.82d));
            m.Atoms.Add(Atom("C", 3, 0.00d, 1.65d));
            m.Atoms.Add(Atom("C", 3, -0.71d, -2.06d));
            m.Atoms.Add(Atom("C", 1, -0.00d, -1.65d));
            m.Atoms.Add(Atom("C", 3, 0.71d, -2.06d));
            m.Atoms.Add(Atom("C", 1, -0.00d, -0.83d));
            m.AddBond(m.Atoms[9], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[0], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[9], m.Atoms[7], BondOrder.Single);
            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);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

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

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            var elements = recon.Recognise(new[] { Projection.Haworth }).ToReadOnlyList();

            Assert.IsTrue(elements.Count == 0);
        }
コード例 #11
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);
        }
コード例 #12
0
        public void BetaDGlucose_Chair_Rotated()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 1, -0.77d, 10.34d));
            m.Atoms.Add(Atom("C", 1, 0.03d, 10.13d));
            m.Atoms.Add(Atom("O", 0, 0.83d, 10.34d));
            m.Atoms.Add(Atom("C", 1, 1.24d, 9.63d));
            m.Atoms.Add(Atom("C", 1, 0.44d, 9.84d));
            m.Atoms.Add(Atom("C", 1, -0.35d, 9.63d));
            m.Atoms.Add(Atom("O", 1, 0.86d, 9.13d));
            m.Atoms.Add(Atom("O", 1, 2.04d, 9.84d));
            m.Atoms.Add(Atom("C", 2, -0.68d, 10.54d));
            m.Atoms.Add(Atom("O", 1, -0.68d, 11.37d));
            m.Atoms.Add(Atom("O", 1, -1.48d, 9.93d));
            m.Atoms.Add(Atom("O", 1, -1.15d, 9.84d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[0], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[10], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[11], BondOrder.Single);

            Vector2 center = GeometryUtil.Get2DCenter(m);

            GeometryUtil.Rotate(m, center, Vectors.DegreeToRadian(-80));

            for (int i = 0; i < 30; i++)
            {
                GeometryUtil.Rotate(m, center, Vectors.DegreeToRadian(5));

                EdgeToBondMap bondMap       = EdgeToBondMap.WithSpaceFor(m);
                int[][]       graph         = GraphUtil.ToAdjList(m, bondMap);
                Stereocenters stereocenters = new Stereocenters(m, graph, bondMap);
                stereocenters.CheckSymmetry();
                CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                        stereocenters);

                var elements = recon.Recognise(new[] { Projection.Chair }).ToReadOnlyList();
                m.SetStereoElements(elements);

                AssertTetrahedralCenter(elements[0],
                                        m.Atoms[1],
                                        TetrahedralStereo.Clockwise,
                                        m.Atoms[8], m.Atoms[0], m.Atoms[1], m.Atoms[2]);
                AssertTetrahedralCenter(elements[1],
                                        m.Atoms[3],
                                        TetrahedralStereo.Clockwise,
                                        m.Atoms[7], m.Atoms[2], m.Atoms[3], m.Atoms[4]);
                AssertTetrahedralCenter(elements[2],
                                        m.Atoms[4],
                                        TetrahedralStereo.Clockwise,
                                        m.Atoms[4], m.Atoms[3], m.Atoms[6], m.Atoms[5]);
                AssertTetrahedralCenter(elements[3],
                                        m.Atoms[5],
                                        TetrahedralStereo.Clockwise,
                                        m.Atoms[11], m.Atoms[4], m.Atoms[5], m.Atoms[0]);
                AssertTetrahedralCenter(elements[4],
                                        m.Atoms[0],
                                        TetrahedralStereo.Clockwise,
                                        m.Atoms[0], m.Atoms[5], m.Atoms[10], m.Atoms[1]);
            }
        }
コード例 #13
0
        public void Atp_Haworth()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("O", 0, 2.56d, -6.46d));
            m.Atoms.Add(Atom("C", 1, 1.90d, -6.83d));
            m.Atoms.Add(Atom("C", 1, 2.15d, -7.46d));
            m.Atoms.Add(Atom("C", 1, 2.98d, -7.46d));
            m.Atoms.Add(Atom("C", 1, 3.23d, -6.83d));
            m.Atoms.Add(Atom("C", 2, 1.90d, -6.00d));
            m.Atoms.Add(Atom("O", 0, 1.18d, -5.59d));
            m.Atoms.Add(Atom("O", 1, 2.15d, -8.29d));
            m.Atoms.Add(Atom("O", 1, 2.98d, -8.29d));
            m.Atoms.Add(Atom("P", 0, 0.36d, -5.59d));
            m.Atoms.Add(Atom("O", 0, -0.47d, -5.59d));
            m.Atoms.Add(Atom("O", 0, 0.36d, -4.76d));
            m.Atoms.Add(Atom("O", 1, 0.36d, -6.41d));
            m.Atoms.Add(Atom("P", 0, -1.29d, -5.59d));
            m.Atoms.Add(Atom("O", 0, -2.12d, -5.59d));
            m.Atoms.Add(Atom("O", 0, -1.29d, -4.76d));
            m.Atoms.Add(Atom("O", 1, -1.29d, -6.41d));
            m.Atoms.Add(Atom("P", 0, -2.94d, -5.59d));
            m.Atoms.Add(Atom("O", 1, -3.77d, -5.59d));
            m.Atoms.Add(Atom("O", 0, -2.94d, -4.76d));
            m.Atoms.Add(Atom("O", 1, -2.94d, -6.41d));
            m.Atoms.Add(Atom("C", 0, 4.73d, -4.51d));
            m.Atoms.Add(Atom("C", 0, 4.02d, -4.92d));
            m.Atoms.Add(Atom("C", 0, 4.02d, -5.75d));
            m.Atoms.Add(Atom("N", 0, 4.73d, -6.16d));
            m.Atoms.Add(Atom("N", 0, 5.44d, -5.75d));
            m.Atoms.Add(Atom("C", 1, 5.44d, -4.92d));
            m.Atoms.Add(Atom("C", 1, 2.75d, -5.33d));
            m.Atoms.Add(Atom("N", 0, 3.23d, -4.67d));
            m.Atoms.Add(Atom("N", 2, 4.73d, -3.68d));
            m.Atoms.Add(Atom("N", 0, 3.23d, -6.00d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[6], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[9], m.Atoms[10], BondOrder.Single);
            m.AddBond(m.Atoms[9], m.Atoms[11], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[9], m.Atoms[12], BondOrder.Single);
            m.AddBond(m.Atoms[13], m.Atoms[14], BondOrder.Single);
            m.AddBond(m.Atoms[13], m.Atoms[15], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[13], m.Atoms[16], BondOrder.Single);
            m.AddBond(m.Atoms[10], m.Atoms[13], BondOrder.Single);
            m.AddBond(m.Atoms[17], m.Atoms[18], BondOrder.Single);
            m.AddBond(m.Atoms[17], m.Atoms[19], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[17], m.Atoms[20], BondOrder.Single);
            m.AddBond(m.Atoms[14], m.Atoms[17], BondOrder.Single);
            m.AddBond(m.Atoms[21], m.Atoms[22], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[22], m.Atoms[23], BondOrder.Single);
            m.AddBond(m.Atoms[23], m.Atoms[24], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[24], m.Atoms[25], BondOrder.Single);
            m.AddBond(m.Atoms[25], m.Atoms[26], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[21], m.Atoms[26], BondOrder.Single);
            m.AddBond(m.Atoms[27], m.Atoms[28], BondOrder.Double, BondStereo.EZByCoordinates);
            m.AddBond(m.Atoms[22], m.Atoms[28], BondOrder.Single);
            m.AddBond(m.Atoms[21], m.Atoms[29], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[30], BondOrder.Single);
            m.AddBond(m.Atoms[30], m.Atoms[27], BondOrder.Single);
            m.AddBond(m.Atoms[23], m.Atoms[30], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][] graph = GraphUtil.ToAdjList(m, bondMap);

            Stereocenters stereocenters = new Stereocenters(m, graph, bondMap);

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            var elements = recon.Recognise(new[] { Projection.Haworth }).ToReadOnlyList();

            AssertTetrahedralCenter(elements[0],
                                    m.Atoms[1],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[5], m.Atoms[0], m.Atoms[1], m.Atoms[2]);
            AssertTetrahedralCenter(elements[1],
                                    m.Atoms[2],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[2], m.Atoms[1], m.Atoms[7], m.Atoms[3]);
            AssertTetrahedralCenter(elements[2],
                                    m.Atoms[3],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[3], m.Atoms[2], m.Atoms[8], m.Atoms[4]);
            AssertTetrahedralCenter(elements[3],
                                    m.Atoms[4],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[30], m.Atoms[3], m.Atoms[4], m.Atoms[0]);
        }
コード例 #14
0
        public void Oxpene()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 1, 1.39d, 3.65d));
            m.Atoms.Add(Atom("C", 2, 2.22d, 3.65d));
            m.Atoms.Add(Atom("C", 1, 2.93d, 4.07d));
            m.Atoms.Add(Atom("C", 1, 0.68d, 4.07d));
            m.Atoms.Add(Atom("C", 1, 1.01d, 4.63d));
            m.Atoms.Add(Atom("C", 1, 2.52d, 4.64d));
            m.Atoms.Add(Atom("O", 0, 1.76d, 4.89d));
            m.Atoms.Add(Atom("O", 1, 0.68d, 3.24d));
            m.Atoms.Add(Atom("C", 2, 1.01d, 5.45d));
            m.Atoms.Add(Atom("O", 1, 0.18d, 5.45d));
            m.Atoms.Add(Atom("C", 3, 2.52d, 5.46d));
            m.Atoms.Add(Atom("O", 0, 2.93d, 3.24d));
            m.Atoms.Add(Atom("C", 2, 1.39d, 4.48d));
            m.Atoms.Add(Atom("C", 3, 2.22d, 4.48d));
            m.Atoms.Add(Atom("C", 2, 3.76d, 3.24d));
            m.Atoms.Add(Atom("C", 2, 4.34d, 2.66d));
            m.Atoms.Add(Atom("O", 0, 5.16d, 2.66d));
            m.Atoms.Add(Atom("C", 3, 5.58d, 3.37d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[8], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[5], m.Atoms[10], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[11], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[12], BondOrder.Single);
            m.AddBond(m.Atoms[12], m.Atoms[13], BondOrder.Single);
            m.AddBond(m.Atoms[11], m.Atoms[14], BondOrder.Single);
            m.AddBond(m.Atoms[14], m.Atoms[15], BondOrder.Single);
            m.AddBond(m.Atoms[15], m.Atoms[16], BondOrder.Single);
            m.AddBond(m.Atoms[16], m.Atoms[17], BondOrder.Single);
            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][] graph = GraphUtil.ToAdjList(m, bondMap);

            Stereocenters stereocenters = new Stereocenters(m, graph, bondMap);

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            var elements = recon.Recognise(new[] { Projection.Haworth }).ToReadOnlyList();

            AssertTetrahedralCenter(elements[0],
                                    m.Atoms[2],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[2], m.Atoms[1], m.Atoms[11], m.Atoms[5]);
            AssertTetrahedralCenter(elements[1],
                                    m.Atoms[5],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[10], m.Atoms[2], m.Atoms[5], m.Atoms[6]);
            AssertTetrahedralCenter(elements[2],
                                    m.Atoms[4],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[8], m.Atoms[6], m.Atoms[4], m.Atoms[3]);
            AssertTetrahedralCenter(elements[3],
                                    m.Atoms[3],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[3], m.Atoms[4], m.Atoms[7], m.Atoms[0]);
            AssertTetrahedralCenter(elements[4],
                                    m.Atoms[0],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[12], m.Atoms[3], m.Atoms[0], m.Atoms[1]);
        }
コード例 #15
0
        public void BetaDGlucoseWithExplicitHydrogens_Haworth()
        {
            var m = new AtomContainer();

            m.Atoms.Add(Atom("C", 0, 4.16d, 1.66d));
            m.Atoms.Add(Atom("C", 0, 3.75d, 0.94d));
            m.Atoms.Add(Atom("C", 0, 4.16d, 0.23d));
            m.Atoms.Add(Atom("C", 0, 5.05d, 0.23d));
            m.Atoms.Add(Atom("C", 0, 5.46d, 0.94d));
            m.Atoms.Add(Atom("O", 0, 5.05d, 1.66d));
            m.Atoms.Add(Atom("O", 1, 5.46d, 1.48d));
            m.Atoms.Add(Atom("C", 2, 4.16d, 2.20d));
            m.Atoms.Add(Atom("O", 1, 3.45d, 2.61d));
            m.Atoms.Add(Atom("O", 1, 3.74d, 0.50d));
            m.Atoms.Add(Atom("O", 1, 4.16d, 0.77d));
            m.Atoms.Add(Atom("O", 1, 5.04d, -0.21d));
            m.Atoms.Add(Atom("H", 0, 4.15d, -0.21d));
            m.Atoms.Add(Atom("H", 0, 5.05d, 0.77d));
            m.Atoms.Add(Atom("H", 0, 5.45d, 0.50d));
            m.Atoms.Add(Atom("H", 0, 3.75d, 1.48d));
            m.Atoms.Add(Atom("H", 0, 4.17d, 1.15d));
            m.AddBond(m.Atoms[0], m.Atoms[1], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[2], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[3], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[4], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[5], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[6], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[7], BondOrder.Single);
            m.AddBond(m.Atoms[7], m.Atoms[8], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[9], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[10], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[11], BondOrder.Single);
            m.AddBond(m.Atoms[2], m.Atoms[12], BondOrder.Single);
            m.AddBond(m.Atoms[3], m.Atoms[13], BondOrder.Single);
            m.AddBond(m.Atoms[4], m.Atoms[14], BondOrder.Single);
            m.AddBond(m.Atoms[1], m.Atoms[15], BondOrder.Single);
            m.AddBond(m.Atoms[0], m.Atoms[16], BondOrder.Single);

            EdgeToBondMap bondMap = EdgeToBondMap.WithSpaceFor(m);

            int[][] graph = GraphUtil.ToAdjList(m, bondMap);

            Stereocenters stereocenters = new Stereocenters(m, graph, bondMap);

            stereocenters.CheckSymmetry();
            CyclicCarbohydrateRecognition recon = new CyclicCarbohydrateRecognition(m, graph, bondMap,
                                                                                    stereocenters);

            var elements = recon.Recognise(new[] { Projection.Haworth }).ToReadOnlyList();

            AssertTetrahedralCenter(elements[0],
                                    m.Atoms[1],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[15], m.Atoms[0], m.Atoms[9], m.Atoms[2]);
            AssertTetrahedralCenter(elements[1],
                                    m.Atoms[2],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[10], m.Atoms[1], m.Atoms[12], m.Atoms[3]);
            AssertTetrahedralCenter(elements[2],
                                    m.Atoms[3],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[13], m.Atoms[2], m.Atoms[11], m.Atoms[4]);
            AssertTetrahedralCenter(elements[3],
                                    m.Atoms[4],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[6], m.Atoms[3], m.Atoms[14], m.Atoms[5]);
            AssertTetrahedralCenter(elements[4],
                                    m.Atoms[0],
                                    TetrahedralStereo.AntiClockwise,
                                    m.Atoms[7], m.Atoms[5], m.Atoms[16], m.Atoms[1]);
        }