Exemplo n.º 1
0
        /// <summary>
        /// Filter the mappings for those which cover a unique set of bonds in the
        /// target.
        /// </summary>
        /// <returns>fluent-api instance</returns>
        /// <seealso cref="GetUniqueAtoms"/>
        public Mappings GetUniqueBonds()
        {
            // we need the unique predicate to be reset for each new iterator -
            // otherwise multiple iterations are always filtered (seen before)
            int[][] g = GraphUtil.ToAdjList(query);
            var     m = new UniqueBondMatches(g);

            return(new Mappings(query, target, iterable.Where(n => m.Apply(n))));
        }
Exemplo n.º 2
0
        public void UniqueBonds()
        {
            IAtomContainer query  = Smi("C1CCC1");
            IAtomContainer target = Smi("C12C3C1C23");

            var mappings = VentoFoggia.CreateSubstructureFinder(query).MatchAll(target);

            // using unique atoms we may think we only found 1 mapping
            {
                var p = new UniqueAtomMatches();
                Assert.AreEqual(1, mappings.Count(p.Apply));
            }

            // when in fact we found 4 different mappings
            {
                var p = new UniqueBondMatches(GraphUtil.ToAdjList(query));
                Assert.AreEqual(3, mappings.Count(p.Apply));
            }
        }