Example #1
0
        public override void TestInitiate_IAtomContainerSet_IAtomContainerSet()
        {
            IReactionProcess type = new CarbonylEliminationReaction();
            /* [C*]-C-C */
            var setOfReactants = GetExampleReactants();

            /* initiate */
            var paramList            = new List <IParameterReaction>();
            IParameterReaction param = new SetReactionCenter
            {
                IsSetParameter = false
            };

            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(1, setOfReactions.Count);
            Assert.AreEqual(2, setOfReactions[0].Products.Count);

            IAtomContainer product1  = setOfReactions[0].Products[0];
            IAtomContainer molecule1 = GetExpectedProducts()[0];//CreateFromSmiles("[C+]");

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule1, product1));

            IAtomContainer product2  = setOfReactions[0].Products[1];
            IAtomContainer molecule2 = GetExpectedProducts()[1];//CreateFromSmiles("[C-]#[O+]");

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, product2));
        }
Example #2
0
        public void TestMappingExample1()
        {
            IReactionProcess type = new CarbonylEliminationReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* initiate */
            var paramList            = new List <IParameterReaction>();
            IParameterReaction param = new SetReactionCenter
            {
                IsSetParameter = false
            };

            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            IAtomContainer product1 = setOfReactions[0].Products[0];
            IAtomContainer product2 = setOfReactions[0].Products[1];

            Assert.AreEqual(6, setOfReactions[0].Mappings.Count);
            IAtom mappedProductA1 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                                   molecule.Atoms[0]);

            Assert.AreEqual(mappedProductA1, product1.Atoms[0]);
            IAtom mappedProductA2 = (IAtom)ReactionManipulator.GetMappedChemObject(setOfReactions[0],
                                                                                   molecule.Atoms[4]);

            Assert.AreEqual(mappedProductA2, product2.Atoms[0]);
        }
Example #3
0
        public void TestManuallyPCentreActiveExample1()
        {
            IReactionProcess type = new CarbonylEliminationReaction();

            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* initiate */
            /* manually put the reactive center */
            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[4].IsReactiveCenter = true;
            molecule.Atoms[5].IsReactiveCenter = true;
            molecule.Bonds[3].IsReactiveCenter = true;
            molecule.Bonds[4].IsReactiveCenter = true;

            var paramList            = new List <IParameterReaction>();
            IParameterReaction param = new SetReactionCenter
            {
                IsSetParameter = true
            };

            paramList.Add(param);
            type.ParameterList = paramList;
            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(1, setOfReactions.Count);
            Assert.AreEqual(2, setOfReactions[0].Products.Count);

            IAtomContainer product1  = setOfReactions[0].Products[0];
            IAtomContainer molecule1 = GetExpectedProducts()[0];//CreateFromSmiles("[C+]");

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule1, product1));

            IAtomContainer product2  = setOfReactions[0].Products[1];
            IAtomContainer molecule2 = GetExpectedProducts()[1];//CreateFromSmiles("[C-]#[O+]");

            Assert.IsTrue(new UniversalIsomorphismTester().IsIsomorph(molecule2, product2));
        }
Example #4
0
        public void TestCarbonylEliminationReaction()
        {
            IReactionProcess type = new CarbonylEliminationReaction();

            Assert.IsNotNull(type);
        }