Ejemplo 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);
        }
Ejemplo 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
        }
Ejemplo 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
        }
Ejemplo 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);
        }
Ejemplo 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));
            }
        }
Ejemplo n.º 6
0
Archivo: Pattern.cs Proyecto: 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));
 }
Ejemplo n.º 7
0
Archivo: Pattern.cs Proyecto: 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));
 }
Ejemplo 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));
 }
Ejemplo 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));
 }