예제 #1
0
        public void TestBB_AutomaticSearchCentreActiveFormaldehyde()
        {
            IReactionProcess type         = new HeterolyticCleavagePBReaction();
            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* automatic search of the reactive atoms and bonds */
            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = false;
            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
            MakeSureAtomTypesAreRecognized(molecule);

            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(1, setOfReactions.Count);

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

            IAtomContainer product = setOfReactions[0].Products[0];

            Assert.IsTrue(uiTester.IsIsomorph(GetExpectedProducts()[0], product));
        }
예제 #2
0
        public void TestMapping()
        {
            IReactionProcess type         = new HeterolyticCleavagePBReaction();
            var            setOfReactants = GetExampleReactants();
            IAtomContainer molecule       = setOfReactants[0];

            /* automatic search of the center active */
            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = false;
            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */
            var setOfReactions = type.Initiate(setOfReactants, null);

            IAtomContainer product = setOfReactions[0].Products[0];

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

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

            Assert.AreEqual(mappedProductA2, product.Atoms[1]);
        }
예제 #3
0
        public void TestOspDoubleB()
        {
            //CreateFromSmiles("O=C")
            IAtomContainer molecule = builder.NewAtomContainer();

            molecule.Atoms.Add(builder.NewAtom("O"));
            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.AddBond(molecule.Atoms[0], molecule.Atoms[1], BondOrder.Double);
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.Atoms.Add(builder.NewAtom("H"));
            molecule.AddBond(molecule.Atoms[1], molecule.Atoms[2], BondOrder.Single);
            molecule.AddBond(molecule.Atoms[1], molecule.Atoms[3], BondOrder.Single);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
            CDK.LonePairElectronChecker.Saturate(molecule);

            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[1].IsReactiveCenter = true;
            molecule.Bonds[0].IsReactiveCenter = true;

            var setOfReactants = ChemObjectBuilder.Instance.NewAtomContainerSet();

            setOfReactants.Add(molecule);

            IReactionProcess type = new HeterolyticCleavagePBReaction();
            var paramList         = new List <IParameterReaction>();
            var param             = new SetReactionCenter();

            param.IsSetParameter = true;
            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */
            var setOfReactions = type.Initiate(setOfReactants, null);

            Assert.AreEqual(1, setOfReactions.Count);

            // expected products

            //CreateFromSmiles("[O-][C+]")
            IAtomContainer expected1 = builder.NewAtomContainer();

            expected1.Atoms.Add(builder.NewAtom("O"));
            expected1.Atoms[0].FormalCharge = -1;
            expected1.Atoms.Add(builder.NewAtom("C"));
            expected1.Atoms[1].FormalCharge = +1;
            expected1.AddBond(expected1.Atoms[0], expected1.Atoms[1], BondOrder.Single);
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.Atoms.Add(builder.NewAtom("H"));
            expected1.AddBond(expected1.Atoms[1], expected1.Atoms[2], BondOrder.Single);
            expected1.AddBond(expected1.Atoms[1], expected1.Atoms[3], BondOrder.Single);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(expected1);
            CDK.LonePairElectronChecker.Saturate(expected1);
            IAtomContainer     product1  = setOfReactions[0].Products[0];
            QueryAtomContainer queryAtom = QueryAtomContainerCreator.CreateSymbolAndChargeQueryContainer(expected1);

            Assert.IsTrue(uiTester.IsIsomorph(product1, queryAtom));
        }
예제 #4
0
        public void TestCDKConstants_REACTIVE_CENTER()
        {
            IReactionProcess type = new HeterolyticCleavagePBReaction();
            var setOfReactants    = ChemObjectBuilder.Instance.NewAtomContainerSet();

            /* C=O */
            IAtomContainer molecule = builder.NewAtomContainer();//CreateFromSmiles("C=O")

            molecule.Atoms.Add(builder.NewAtom("C"));
            molecule.Atoms.Add(builder.NewAtom("O"));
            molecule.AddBond(molecule.Atoms[0], molecule.Atoms[1], BondOrder.Double);
            AddExplicitHydrogens(molecule);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
            CDK.LonePairElectronChecker.Saturate(molecule);
            setOfReactants.Add(molecule);

            /* manually put the reactive center */
            molecule.Atoms[0].IsReactiveCenter = true;
            molecule.Atoms[1].IsReactiveCenter = true;
            molecule.Bonds[0].IsReactiveCenter = true;

            var paramList = new List <IParameterReaction>();
            var param     = new SetReactionCenter();

            param.IsSetParameter = true;
            paramList.Add(param);
            type.ParameterList = paramList;

            /* initiate */
            MakeSureAtomTypesAreRecognized(molecule);

            var setOfReactions = type.Initiate(setOfReactants, null);

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

            IAtomContainer reactant = setOfReactions[0].Reactants[0];

            Assert.IsTrue(molecule.Atoms[0].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[0].IsReactiveCenter);
            Assert.IsTrue(molecule.Atoms[1].IsReactiveCenter);
            Assert.IsTrue(reactant.Atoms[1].IsReactiveCenter);
            Assert.IsTrue(molecule.Bonds[0].IsReactiveCenter);
            Assert.IsTrue(reactant.Bonds[0].IsReactiveCenter);
        }
예제 #5
0
        public void TestHeterolyticCleavagePBReaction()
        {
            IReactionProcess type = new HeterolyticCleavagePBReaction();

            Assert.IsNotNull(type);
        }