Esempio n. 1
0
        public void BenzeneNonIdentical()
        {
            int[] match = VentoFoggia.FindIdentical(TestMoleculeFactory.MakeBenzene()).Match(TestMoleculeFactory.MakeNaphthalene());
            Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int>(), match));
            int count = VentoFoggia.FindIdentical(TestMoleculeFactory.MakeBenzene()).MatchAll(TestMoleculeFactory.MakeNaphthalene()).ToReadOnlyList().Count;

            Assert.AreEqual(0, count);
        }
Esempio n. 2
0
        public void BenzeneIdentical()
        {
            int[] match = VentoFoggia.FindIdentical(TestMoleculeFactory.MakeBenzene()).Match(TestMoleculeFactory.MakeBenzene());
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5 }, match));
            int count = VentoFoggia.FindIdentical(TestMoleculeFactory.MakeBenzene()).MatchAll(TestMoleculeFactory.MakeBenzene()).ToReadOnlyList().Count;

            Assert.AreEqual(6, count); // note: aromatic one would be 12
        }
Esempio n. 3
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
        }
Esempio n. 4
0
        public void NapthaleneSubsearch()
        {
            int[] match = VentoFoggia.CreateSubstructureFinder(TestMoleculeFactory.MakeNaphthalene()).Match(
                TestMoleculeFactory.MakeBenzene());
            Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int>(), match));
            int count =
                VentoFoggia.CreateSubstructureFinder(TestMoleculeFactory.MakeNaphthalene()).MatchAll(
                    TestMoleculeFactory.MakeBenzene()).ToReadOnlyList().Count;

            Assert.AreEqual(0, count);
        }
Esempio n. 5
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));
            }
        }
Esempio n. 6
0
File: Pattern.cs Progetto: qize/NCDK
 /// <summary>
 /// Create a pattern which can be used to find molecules which are the same
 /// as 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 CreateIdenticalFinder(IAtomContainer query)
 {
     return(VentoFoggia.CreateIdenticalFinder(query));
 }
Esempio n. 7
0
File: Pattern.cs Progetto: qize/NCDK
 /// <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 CreateSubstructureFinder(IAtomContainer query)
 {
     return(VentoFoggia.CreateSubstructureFinder(query));
 }
Esempio n. 8
0
 /// <summary>
 /// Create a pattern which can be used to find molecules which are the same
 /// as 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 FindIdentical(IAtomContainer query)
 {
     return(VentoFoggia.FindIdentical(query));
 }
Esempio n. 9
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));
 }