Exemplo n.º 1
0
        private void SearchMcGregorMapping()
        {
            var mappings = new List <IReadOnlyList <int> >();

            foreach (var firstPassMappings in allMCSCopy)
            {
                McGregor mgit = new McGregor(GetReactantMol(), GetProductMol(), mappings, IsBondMatchFlag);
                mgit.StartMcGregorIteration(mgit.MCSSize, firstPassMappings); //Start McGregor search
                mappings = mgit.mappings;
                mgit     = null;
            }
            SetMcGregorMappings(mappings);
            vfMCSSize = vfMCSSize / 2;
        }
Exemplo n.º 2
0
        internal static List <IReadOnlyList <int> > GetOverlaps(IAtomContainer ac1, IAtomContainer ac2, bool shouldMatchBonds)
        {
            Deque <IReadOnlyList <int> > maxCliqueSet = null;
            var mappings = new List <IReadOnlyList <int> >();

            try
            {
                GenerateCompatibilityGraph gcg = new GenerateCompatibilityGraph(ac1, ac2, shouldMatchBonds);
                var compGraphNodes             = gcg.GetCompGraphNodes();

                var cEdges = gcg.GetCEgdes();
                var dEdges = gcg.GetDEgdes();

                BKKCKCF init = new BKKCKCF(compGraphNodes, cEdges, dEdges);
                maxCliqueSet = init.GetMaxCliqueSet();

                //clear all the compatibility graph content
                gcg.Clear();
                while (maxCliqueSet.Count != 0)
                {
                    var cliqueList = maxCliqueSet.Peek();
                    int cliqueSize = cliqueList.Count;
                    if (cliqueSize < ac1.Atoms.Count && cliqueSize < ac2.Atoms.Count)
                    {
                        McGregor mgit = new McGregor(ac1, ac2, mappings, shouldMatchBonds);
                        mgit.StartMcGregorIteration(mgit.MCSSize, cliqueList, compGraphNodes);
                        mappings = mgit.mappings;
                        mgit     = null;
                    }
                    else
                    {
                        mappings = ExactMapping.ExtractMapping(mappings, compGraphNodes, cliqueList);
                    }
                    maxCliqueSet.Pop();
                    if (IsTimeOut())
                    {
                        break;
                    }
                }
            }
            catch (IOException ex)
            {
                Trace.TraceError(ex.Message);
            }
            return(mappings);
        }
Exemplo n.º 3
0
        private void SearchMcGregorMapping()
        {
            var  mappings = new List <IReadOnlyList <int> >();
            bool ropFlag  = true;

            foreach (var firstPassMappings in allMCSCopy)
            {
                var tMapping = new SortedDictionary <int, int>();
                foreach (var e in firstPassMappings)
                {
                    tMapping.Add(e.Key, e.Value);
                }

                McGregor mgit = null;
                if (queryMol != null)
                {
                    mgit = new McGregor(queryMol, mol2, mappings, IsBondMatchFlag);
                }
                else
                {
                    if (countR > countP)
                    {
                        mgit = new McGregor(mol1, mol2, mappings, IsBondMatchFlag);
                    }
                    else
                    {
                        tMapping.Clear();
                        mgit    = new McGregor(mol2, mol1, mappings, IsBondMatchFlag);
                        ropFlag = false;
                        foreach (var map in firstPassMappings)
                        {
                            tMapping[map.Value] = map.Key;
                        }
                    }
                }
                mgit.StartMcGregorIteration(mgit.MCSSize, tMapping); //Start McGregor search
                mappings = mgit.mappings;
                mgit     = null;
            }
            SetMcGregorMappings(ropFlag, mappings);
            vfMCSSize = vfMCSSize / 2;
        }