Ejemplo n.º 1
0
        public void BenzeneSubsearch()
        {
            int[] match = VentoFoggia.FindSubstructure(TestMoleculeFactory.MakeBenzene()).Match(TestMoleculeFactory.MakeNaphthalene());
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 2, 7, 6, 5, 4, 3 }, match));
            int count =
                VentoFoggia.FindSubstructure(TestMoleculeFactory.MakeBenzene()).MatchAll(
                    TestMoleculeFactory.MakeNaphthalene()).ToReadOnlyList().Count;

            Assert.AreEqual(6, count); // note: aromatic one would be 24
        }
Ejemplo n.º 2
0
        public void NapthaleneSubsearch()
        {
            int[] match = VentoFoggia.FindSubstructure(TestMoleculeFactory.MakeNaphthalene()).Match(
                TestMoleculeFactory.MakeBenzene());
            Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int>(), match));
            int count =
                VentoFoggia.FindSubstructure(TestMoleculeFactory.MakeNaphthalene()).MatchAll(
                    TestMoleculeFactory.MakeBenzene()).ToReadOnlyList().Count;

            Assert.AreEqual(0, count);
        }
Ejemplo n.º 3
0
        public void UniqueBonds()
        {
            IAtomContainer query  = Smi("C1CCC1");
            IAtomContainer target = Smi("C12C3C1C23");

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

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

            // when in fact we found 4 different mappings
            {
                var p = new UniqueBondMatches(GraphUtil.ToAdjList(query));
                Assert.AreEqual(3, mappings.Count(n => p.Apply(n)));
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a pattern which can be used to find molecules which contain the
 /// <paramref name="query"/> structure. The default structure search implementation is
 /// <see cref="VentoFoggia"/>.
 /// </summary>
 /// <param name="query">the substructure to find</param>
 /// <returns>a pattern for finding the <paramref name="query"/></returns>
 /// <seealso cref="VentoFoggia"/>
 public static Pattern FindSubstructure(IAtomContainer query)
 {
     return(VentoFoggia.FindSubstructure(query));
 }