Esempio n. 1
0
        public void HasNext()
        {
            var state = CreateNaphthaleneToBenzene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());
            var it    = new StateStream(state);

            Assert.IsFalse(it.Any());
        }
Esempio n. 2
0
        /// <summary>
        /// Create a pattern which can be used to find molecules which contain the
        /// <paramref name="query"/> structure.
        /// </summary>
        /// <param name="query">the substructure to find</param>
        /// <returns>a pattern for finding the <paramref name="query"/></returns>
        public static new Pattern CreateSubstructureFinder(IAtomContainer query)
        {
            bool isQuery = query is IQueryAtomContainer;

            return(new Ullmann(query, isQuery ? AtomMatcher.CreateQueryMatcher() : AtomMatcher.CreateElementMatcher(),
                               isQuery ? BondMatcher.CreateQueryMatcher() : BondMatcher.CreateOrderMatcher()));
        }
Esempio n. 3
0
        public void Next()
        {
            var state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());
            var it    = new StateStream(state).GetEnumerator();

            it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 7, 8, 9 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 9, 8, 7, 2, 1 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 1, 0, 9, 8, 7, 2 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 1, 2, 7, 8, 9, 0 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 2, 1, 0, 9, 8, 7 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 2, 3, 4, 5, 6, 7 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 2, 7, 6, 5, 4, 3 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 2, 7, 8, 9, 0, 1 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 3, 2, 7, 6, 5, 4 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 3, 4, 5, 6, 7, 2 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 4, 3, 2, 7, 6, 5 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 4, 5, 6, 7, 2, 3 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 5, 4, 3, 2, 7, 6 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 5, 6, 7, 2, 3, 4 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 6, 5, 4, 3, 2, 7 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 6, 7, 2, 3, 4, 5 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 7, 2, 1, 0, 9, 8 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 7, 2, 3, 4, 5, 6 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 7, 6, 5, 4, 3, 2 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 7, 8, 9, 0, 1, 2 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 8, 7, 2, 1, 0, 9 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 8, 9, 0, 1, 2, 7 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 9, 0, 1, 2, 7, 8 }, it.Current)); it.MoveNext();
            Assert.IsTrue(Compares.AreDeepEqual(new int[] { 9, 8, 7, 2, 1, 0 }, it.Current)); it.MoveNext();
        }
Esempio n. 4
0
        /// <summary>
        /// Create a state for matching subgraphs using the Ullmann refinement
        /// procedure.
        /// </summary>
        /// <param name="container1">query container</param>
        /// <param name="container2">target container</param>
        /// <param name="g1">query container adjacency list</param>
        /// <param name="g2">target container adjacency list</param>
        /// <param name="bonds1">query container bond map</param>
        /// <param name="bonds2">target container bond map</param>
        /// <param name="atomMatcher">method of matching atom semantics</param>
        /// <param name="bondMatcher">method of matching bond semantics</param>
        public UllmannState(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2,
                            EdgeToBondMap bonds1, EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
        {
            this.bondMatcher = bondMatcher;
            this.g1          = g1;
            this.g2          = g2;
            this.bond1       = bonds1;
            this.bonds2      = bonds2;
            this.m1          = new int[g1.Length];
            this.m2          = new int[g2.Length];
            Arrays.Fill(m1, UNMAPPED);
            Arrays.Fill(m2, UNMAPPED);

            // build up compatibility matrix
            matrix = new CompatibilityMatrix(g1.Length, g2.Length);
            for (int i = 0; i < g1.Length; i++)
            {
                for (int j = 0; j < g2.Length; j++)
                {
                    if (g1[i].Length <= g2[j].Length && atomMatcher.Matches(container1.Atoms[i], container2.Atoms[j]))
                    {
                        matrix.Set1(i, j);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Create a pattern which can be used to find molecules which are the same
        /// as the <paramref name="query"/> structure.
        /// </summary>
        /// <param name="query">the substructure to find</param>
        /// <returns>a pattern for finding the <paramref name="query"/></returns>
        public static new Pattern CreateIdenticalFinder(IAtomContainer query)
        {
            bool isQuery = query is IQueryAtomContainer;

            return(CreateIdenticalFinder(query,
                                         isQuery ? AtomMatcher.CreateQueryMatcher() : AtomMatcher.CreateElementMatcher(),
                                         isQuery ? BondMatcher.CreateQueryMatcher() : BondMatcher.CreateOrderMatcher()));
        }
Esempio n. 6
0
 /// <summary>
 /// Non-public constructor for-now the atom/bond semantics are fixed.
 /// </summary>
 /// <param name="query">the query structure</param>
 /// <param name="atomMatcher">how atoms should be matched</param>
 /// <param name="bondMatcher">how bonds should be matched</param>
 private Ullmann(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher)
 {
     this.query       = query;
     this.atomMatcher = atomMatcher;
     this.bondMatcher = bondMatcher;
     this.bonds1      = EdgeToBondMap.WithSpaceFor(query);
     this.g1          = GraphUtil.ToAdjList(query, bonds1);
     DetermineFilters(query);
 }
Esempio n. 7
0
        public void ElementPseudo()
        {
            AtomMatcher matcher = AtomMatcher.CreateElementMatcher();
            var         m_atom1 = new Mock <IPseudoAtom>();
            var         m_atom2 = new Mock <IPseudoAtom>();

            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsTrue(matcher.Matches(m_atom2.Object, m_atom1.Object));
        }
Esempio n. 8
0
        public void Accessors()
        {
            UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            state.size = 1;
            Assert.AreEqual(state.Count, 1);
            Assert.AreEqual(state.NMax(), state.g1.Length);
            Assert.AreEqual(state.MMax(), state.g2.Length);
        }
Esempio n. 9
0
        public void Mapping()
        {
            UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            state.m1[0] = 1;
            state.m1[1] = 2;
            Assert.IsTrue(Compares.AreDeepEqual(state.m1, state.Mapping()));
            Assert.AreNotSame(state.m1, state.Mapping());
        }
Esempio n. 10
0
        public void TestNextM()
        {
            UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.AreEqual(state.NextM(0, -1), 0);
            Assert.AreEqual(state.NextM(0, 0), 1);
            Assert.AreEqual(state.NextM(0, 1), 2);
            state.m2[1] = 0; // 1 has been mapped and should be skipped over
            Assert.AreEqual(state.NextM(0, 0), 2);
        }
Esempio n. 11
0
 /// <summary>
 /// Non-public constructor for-now the atom/bond semantics are fixed.
 /// </summary>
 /// <param name="query">the query structure</param>
 /// <param name="atomMatcher">how atoms should be matched</param>
 /// <param name="bondMatcher">how bonds should be matched</param>
 /// <param name="substructure">substructure search</param>
 private VentoFoggia(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher, bool substructure)
 {
     this.query       = query;
     this.atomMatcher = atomMatcher;
     this.bondMatcher = bondMatcher;
     this.bonds1      = EdgeToBondMap.WithSpaceFor(query);
     this.g1          = GraphUtil.ToAdjList(query, bonds1);
     this.subgraph    = substructure;
     DetermineFilters(query);
 }
Esempio n. 12
0
        public void InfeasibleTerminalCount()
        {
            VFSubState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.IsTrue(state.Feasible(0, 0)); // 0,0 is feasible
                                                 // XXX: depends on molecule order not changing
            state.t1[1] = 1;
            state.t1[5] = 1;
            Assert.IsFalse(state.Feasible(0, 0)); // 0,0 is infeasible
        }
Esempio n. 13
0
        public void TestNextN()
        {
            UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.AreEqual(state.NextN(0), 0);
            state.size = 1;
            Assert.AreEqual(state.NextN(0), 1);
            state.size = 2;
            Assert.AreEqual(state.NextN(0), 2);
        }
Esempio n. 14
0
        public void ElementMismatch()
        {
            AtomMatcher matcher = AtomMatcher.CreateElementMatcher();
            var         m_atom1 = new Mock <IAtom>();
            var         m_atom2 = new Mock <IAtom>();

            m_atom1.SetupGet(n => n.AtomicNumber).Returns(6);
            m_atom2.SetupGet(n => n.AtomicNumber).Returns(8);
            Assert.IsFalse(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsFalse(matcher.Matches(m_atom2.Object, m_atom1.Object));
        }
Esempio n. 15
0
        /// <summary>
        /// Create a state for matching benzene to naphthalene Benzene:
        /// InChI=1/C6H6/c1-2-4-6-5-3-1/h1-6H Naphthalene: InChI=1/C10H8/c1-2-6-10-8-4-3-7-9(10)5-1/h1-8H
        /// </summary>
        UllmannState CreateBenzeneToNaphthalene(AtomMatcher atomMatcher, BondMatcher bondMatcher)
        {
            IAtomContainer container1 = TestMoleculeFactory.MakeBenzene();
            IAtomContainer container2 = TestMoleculeFactory.MakeNaphthalene();
            EdgeToBondMap  bonds1     = EdgeToBondMap.WithSpaceFor(container1);
            EdgeToBondMap  bonds2     = EdgeToBondMap.WithSpaceFor(container2);

            int[][] g1 = GraphUtil.ToAdjList(container1, bonds1);
            int[][] g2 = GraphUtil.ToAdjList(container2, bonds2);
            return(new UllmannState(container1, container2, g1, g2, bonds1, bonds2, atomMatcher, bondMatcher));
        }
Esempio n. 16
0
        public void InfeasibleTerminalCount()
        {
            VFState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.IsTrue(state.Feasible(4, 4)); // 4, 4 is feasible
            state.Add(0, 0);
            state.Add(1, 1);
            state.Add(2, 2);
            state.Add(3, 3);
            Assert.IsFalse(state.Feasible(4, 4)); // 4, 4 is infeasible
        }
Esempio n. 17
0
 /// <summary>
 /// Create a VF state for matching isomorphisms. The query is passed first
 /// and should read as, find container1 in container2.
 /// </summary>
 /// <param name="container1">the molecule to search for (query)</param>
 /// <param name="container2">the molecule to search in (target)</param>
 /// <param name="g1">adjacency list of the query</param>
 /// <param name="g2">adjacency list of the target</param>
 /// <param name="bonds1">bond lookup of the query</param>
 /// <param name="bonds2">bond lookup of the target</param>
 /// <param name="atomMatcher">what semantic attributes (symbol, charge, query) determines atoms to be compatible</param>
 /// <param name="bondMatcher">what semantic attributes (order/aromatic, query) determines bonds to be compatible</param>
 public VFState(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2, EdgeToBondMap bonds1,
                EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
     : base(g1, g2)
 {
     this.container1  = container1;
     this.container2  = container2;
     this.bonds1      = bonds1;
     this.bonds2      = bonds2;
     this.atomMatcher = atomMatcher;
     this.bondMatcher = bondMatcher;
 }
Esempio n. 18
0
        public void QueryMatch()
        {
            AtomMatcher matcher = AtomMatcher.CreateQueryMatcher();
            var         m_atom1 = new Mock <IQueryAtom>();
            var         m_atom2 = new Mock <IAtom>();
            var         m_atom3 = new Mock <IAtom>();

            m_atom1.Setup(n => n.Matches(m_atom2.Object)).Returns(true);
            m_atom1.Setup(n => n.Matches(m_atom3.Object)).Returns(false);
            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsFalse(matcher.Matches(m_atom1.Object, m_atom3.Object));
        }
Esempio n. 19
0
 /// <summary>
 /// Create a match for the following parameters.
 /// </summary>
 /// <param name="container1">query structure</param>
 /// <param name="container2">target structure</param>
 /// <param name="g1">query adjacency list</param>
 /// <param name="g2">target adjacency list</param>
 /// <param name="bonds1">query bond map</param>
 /// <param name="bonds2">target bond map</param>
 /// <param name="atomMatcher">how atoms are matched</param>
 /// <param name="bondMatcher">how bonds are matched</param>
 public UllmannIterable(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2,
                        EdgeToBondMap bonds1, EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
 {
     this.container1  = container1;
     this.container2  = container2;
     this.g1          = g1;
     this.g2          = g2;
     this.bonds1      = bonds1;
     this.bonds2      = bonds2;
     this.atomMatcher = atomMatcher;
     this.bondMatcher = bondMatcher;
 }
Esempio n. 20
0
        public void HasNext2()
        {
            var state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());
            int cnt   = 0;
            var it    = new StateStream(state);

            foreach (var i in it)
            {
                Assert.IsNotNull(i);
                cnt++;
            }
            Assert.AreEqual(24, cnt);
        }
Esempio n. 21
0
 /// <summary>
 /// Create a match for the following parameters.
 /// </summary>
 /// <param name="container1">query structure</param>
 /// <param name="container2">target structure</param>
 /// <param name="g1">query adjacency list</param>
 /// <param name="g2">target adjacency list</param>
 /// <param name="bonds1">query bond map</param>
 /// <param name="bonds2">target bond map</param>
 /// <param name="atomMatcher">how atoms are matched</param>
 /// <param name="bondMatcher">how bonds are matched</param>
 /// <param name="subgraph">perform subgraph search</param>
 public VFIterable(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2,
                   EdgeToBondMap bonds1, EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher,
                   bool subgraph)
 {
     this.container1  = container1;
     this.container2  = container2;
     this.g1          = g1;
     this.g2          = g2;
     this.bonds1      = bonds1;
     this.bonds2      = bonds2;
     this.atomMatcher = atomMatcher;
     this.bondMatcher = bondMatcher;
     this.subgraph    = subgraph;
 }
Esempio n. 22
0
        public void InfeasibleAtoms()
        {
            var m = new Mock <AtomMatcher>(); AtomMatcher mock = m.Object;

            m.Setup(n => n.Matches(It.IsAny <IAtom>(), It.IsAny <IAtom>())).Returns(false);
            VFSubState state = CreateBenzeneToNaphthalene(mock, new Mock <BondMatcher>().Object);

            for (int i = 0; i < state.NMax(); i++)
            {
                for (int j = 0; j < state.MMax(); j++)
                {
                    Assert.IsFalse(state.Feasible(i, j));
                }
            }
        }
Esempio n. 23
0
        public void AnyMatch()
        {
            AtomMatcher matcher = AtomMatcher.CreateAnyMatcher();
            var         m_atom1 = new Mock <IAtom>();
            var         m_atom2 = new Mock <IAtom>();
            var         m_atom3 = new Mock <IAtom>();

            m_atom1.SetupGet(n => n.AtomicNumber).Returns(6);
            m_atom2.SetupGet(n => n.AtomicNumber).Returns(7);
            m_atom3.SetupGet(n => n.AtomicNumber).Returns(8);
            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsTrue(matcher.Matches(m_atom2.Object, m_atom1.Object));
            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom3.Object));
            Assert.IsTrue(matcher.Matches(m_atom3.Object, m_atom1.Object));
            Assert.IsTrue(matcher.Matches(m_atom2.Object, m_atom3.Object));
            Assert.IsTrue(matcher.Matches(m_atom1.Object, null));
            Assert.IsTrue(matcher.Matches(null, null));
        }
Esempio n. 24
0
        public void InfeasibleBonds()
        {
            var m = new Mock <BondMatcher>(); BondMatcher mock = m.Object;

            m.Setup(n => n.Matches(It.IsAny <IBond>(), It.IsAny <IBond>())).Returns(false);
            VFSubState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), mock);

            state.m1[0] = 0;
            state.m1[1] = 1;
            state.m1[2] = 2;
            state.m1[3] = 3;
            state.m1[4] = 4;
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Assert.IsFalse(state.Feasible(i, j));
                }
            }
        }
Esempio n. 25
0
        public void Add()
        {
            UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
            },
                              state.matrix.Fix()
                              ));
            Assert.IsTrue(state.Add(0, 0));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, 1, -1, -1, -1, 1, -1, 1 },
                new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 }
            },
                              state.matrix.Fix()));
            Assert.IsTrue(state.Add(1, 9));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { 1, -1, -2, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, -2, -1, -1, -1, 1, -1, 1 },
                new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 }
            },
                              state.matrix.Fix()));
            Assert.IsTrue(state.Add(2, 8));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, 1 },
                new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 }
            },
                              state.matrix.Fix()));
            Assert.IsTrue(state.Add(3, 7));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 },
                new[] { -4, -1, 1, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 }
            },
                              state.matrix.Fix()));
            Assert.IsTrue(state.Add(4, 2));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[]  { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 },
                new[] { -4, -1, 1, -1, -1, -1, -1, -1, -5, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, -5 }
            },
                              state.matrix.Fix()));
            Assert.IsTrue(state.Add(5, 1));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[][] {
                new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
                new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 },
                new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 },
                new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 },
                new[] { -4, -1, 1, -1, -1, -1, -1, -1, -5, -1 },
                new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, -5 }
            },
                              state.matrix.Fix()));
        }
Esempio n. 26
0
 /// <summary>
 /// Create a pattern which can be used to find molecules which contain the
 /// <paramref name="query"/> structure.
 /// </summary>
 /// <param name="query">the substructure to find</param>
 /// <param name="atomMatcher">how atoms are matched</param>
 /// <param name="bondMatcher">how bonds are matched</param>
 /// <returns>a pattern for finding the <paramref name="query"/></returns>
 public static Pattern CreateSubstructureFinder(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher)
 {
     return(new VentoFoggia(query, atomMatcher, bondMatcher, true));
 }
Esempio n. 27
0
 /// <summary>
 /// Create a pattern which can be used to find molecules which are the same
 /// as the <paramref name="query"/> structure.
 /// </summary>
 /// <param name="query">the substructure to find</param>
 /// <param name="atomMatcher">how atoms are matched</param>
 /// <param name="bondMatcher">how bonds are matched</param>
 /// <returns>a pattern for finding the <paramref name="query"/></returns>
 public static Pattern CreateIdenticalFinder(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher)
 {
     return(new VentoFoggia(query, atomMatcher, bondMatcher, false));
 }