Ejemplo n.º 1
0
        public void TestItShouldMapSixAtomsOfBenzeneOntoBenzene()
        {
            IMapper mapper = new VFMapper(benzene, true);
            var     map    = mapper.GetFirstMap(benzene);

            Assert.AreEqual(6, map.Count);
        }
Ejemplo n.º 2
0
        public void TestItShouldFindAMapForEquivalentFormsOfToluene()
        {
            IMapper mapper = new VFMapper(toluene, true);
            var     map    = mapper.GetFirstMap(toluene4);

            Assert.AreEqual(7, map.Count);
        }
Ejemplo n.º 3
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);
            }
        }