Example #1
0
        private void SearchVFMappings()
        {
            //        Console.Out.WriteLine("searchVFMappings ");
            IQuery  query  = null;
            IMapper mapper = null;

            vfLibSolutions = new Dictionary <INode, IAtom>();
            if (queryMol != null)
            {
                query  = new QueryCompiler(queryMol).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetProductMol()))
                {
                    var map = mapper.GetFirstMap(GetProductMol());
                    if (map != null)
                    {
                        foreach (var e in map)
                        {
                            vfLibSolutions[e.Key] = e.Value;
                        }
                    }
                }
                SetVFMappings(true, query);
            }
            else if (GetReactantMol().Atoms.Count <= GetProductMol().Atoms.Count)
            {
                query  = new QueryCompiler(mol1, IsBondMatchFlag).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetProductMol()))
                {
                    var map = mapper.GetFirstMap(GetProductMol());
                    if (map != null)
                    {
                        foreach (var e in map)
                        {
                            vfLibSolutions[e.Key] = e.Value;
                        }
                    }
                }
                SetVFMappings(true, query);
            }
            else
            {
                query  = new QueryCompiler(GetProductMol(), IsBondMatchFlag).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetReactantMol()))
                {
                    var map = mapper.GetFirstMap(GetReactantMol());
                    if (map != null)
                    {
                        foreach (var e in map)
                        {
                            vfLibSolutions[e.Key] = e.Value;
                        }
                    }
                }
                SetVFMappings(false, query);
            }
        }
Example #2
0
        public void TestItShouldNotMatchBenzeneToPyridine()
        {
            IMapper mapper = new VFMapper(benzene, true);

            Assert.IsFalse(mapper.HasMap(pyridine));

            mapper = new VFMapper(pyridine, true);

            Assert.IsFalse(mapper.HasMap(benzene));
        }
        private void SearchVFMappings()
        {
            IQuery  query  = null;
            IMapper mapper = null;

            vfLibSolutions = new List <IReadOnlyDictionary <INode, IAtom> >();
            if (queryMol != null)
            {
                query  = new QueryCompiler(queryMol).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetProductMol()))
                {
                    var maps = mapper.GetMaps(GetProductMol());
                    if (maps != null)
                    {
                        vfLibSolutions.AddRange(maps);
                    }
                }
                SetVFMappings(true, query);
            }
            else if (GetReactantMol().Atoms.Count <= GetProductMol().Atoms.Count)
            {
                query  = new QueryCompiler(mol1, IsBondMatchFlag).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetProductMol()))
                {
                    var maps = mapper.GetMaps(GetProductMol());
                    if (maps != null)
                    {
                        vfLibSolutions.AddRange(maps);
                    }
                }
                SetVFMappings(true, query);
            }
            else
            {
                query  = new QueryCompiler(GetProductMol(), IsBondMatchFlag).Compile();
                mapper = new VFMapper(query);
                if (mapper.HasMap(GetReactantMol()))
                {
                    var maps = mapper.GetMaps(GetReactantMol());
                    if (maps != null)
                    {
                        vfLibSolutions.AddRange(maps);
                    }
                }
                SetVFMappings(false, query);
            }
        }
Example #4
0
        public void TestItShouldMatchHexaneToHexaneWhenUsingMolecule()
        {
            IMapper mapper = new VFMapper(hexane, true);

            Assert.IsTrue(mapper.HasMap(hexane));
        }
Example #5
0
        public void TestItShouldNotMatchTolueneToPhenol()
        {
            IMapper mapper = new VFMapper(toluene, true);

            Assert.IsFalse(mapper.HasMap(phenol));
        }
Example #6
0
        public void TestItShouldMatchPropaneToCyclopropane()
        {
            IMapper mapper = new VFMapper(propane, true);

            Assert.IsTrue(mapper.HasMap(cyclopropane));
        }
Example #7
0
        public void TestItShouldMatchAcetoneToAcetone()
        {
            IMapper mapper = new VFMapper(acetone, true);

            Assert.IsTrue(mapper.HasMap(acetone));
        }
Example #8
0
        public void TestItShouldNotMatchTolueneToBenzene()
        {
            IMapper mapper = new VFMapper(toluene, true);

            Assert.IsFalse(mapper.HasMap(benzene));
        }
Example #9
0
        public void TestItShouldNotMatchChlorobenzeneTo4ChloroIsoquinoline()
        {
            IMapper mapper = new VFMapper(chlorobenzene, true);

            Assert.IsFalse(mapper.HasMap(chloroisoquinoline4));
        }
Example #10
0
        public void TestItShouldNotMatchPyridazineToNaphthalene()
        {
            IMapper mapper = new VFMapper(pyridazine, true);

            Assert.IsFalse(mapper.HasMap(naphthalene));
        }
Example #11
0
        public void TestItShouldMatchBenzeneToBenzene()
        {
            IMapper mapper = new VFMapper(benzene, true);

            Assert.IsTrue(mapper.HasMap(benzene));
        }