Ejemplo n.º 1
0
        void Main()
        {
            #region
            // simple
            IMoleculeHashGenerator generator0 = new HashGeneratorMaker().Depth(16)
                                                .Elemental()
                                                .Molecular();

            // fast
            IMoleculeHashGenerator generator1 = new HashGeneratorMaker().Depth(8)
                                                .Elemental()
                                                .Isotopic()
                                                .Charged()
                                                .Orbital()
                                                .Molecular();
            // comprehensive
            IMoleculeHashGenerator generator2 = new HashGeneratorMaker().Depth(32)
                                                .Elemental()
                                                .Isotopic()
                                                .Charged()
                                                .Chiral()
                                                .Perturbed()
                                                .Molecular();
            #endregion
        }
Ejemplo n.º 2
0
        public void TestOrbital()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Orbital().Atomic();
            var encoders = GetEncoders((BasicAtomHashGenerator)generator);

            Assert.AreEqual(1, encoders.Count);
            Assert.AreEqual(BasicAtomEncoder.OrbitalHybridization, encoders[0]);
        }
Ejemplo n.º 3
0
        public void TestRadical()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Radical().Atomic();
            var encoders = GetEncoders((BasicAtomHashGenerator)generator);

            Assert.AreEqual(1, encoders.Count);
            Assert.AreEqual(BasicAtomEncoder.FreeRadicals, encoders[0]);
        }
Ejemplo n.º 4
0
        public void TestCharged()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Charged().Atomic();
            var encoders = GetEncoders((BasicAtomHashGenerator)generator);

            Assert.AreEqual(1, encoders.Count);
            Assert.AreEqual(BasicAtomEncoder.FormalCharge, encoders[0]);
        }
Ejemplo n.º 5
0
        public void TestIsotopic()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Isotopic().Atomic();
            var encoders = GetEncoders((BasicAtomHashGenerator)generator);

            Assert.AreEqual(1, encoders.Count);
            Assert.AreEqual(BasicAtomEncoder.MassNumber, encoders[0]);
        }
Ejemplo n.º 6
0
        public void TestDepth()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(5).Elemental().Atomic();
            var depthField = generator.GetType().GetField("depth", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            int value      = (int)depthField.GetValue(generator);

            Assert.AreEqual(5, value);
        }
Ejemplo n.º 7
0
        public void TestOrdering()
        {
            IAtomHashGenerator g1 = new HashGeneratorMaker().Depth(0).Elemental().Isotopic().Charged().Atomic();
            IAtomHashGenerator g2 = new HashGeneratorMaker().Depth(0).Isotopic().Charged().Elemental().Atomic();

            Assert.AreEqual(3, GetEncoders(g1).Count);
            Assert.IsTrue(Compares.AreDeepEqual(GetEncoders(g1), GetEncoders(g2)));
        }
Ejemplo n.º 8
0
        public void TestPerturbedWith()
        {
            var m_mock = new Mock <EquivalentSetFinder>(); var mock = m_mock.Object;
            IAtomHashGenerator g1 = new HashGeneratorMaker().Depth(0).Elemental().PerturbWith(mock).Atomic();

            Assert.IsTrue(g1 is PerturbedAtomHashGenerator);
            var field = g1.GetType().GetField("finder", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.AreSame(mock, (EquivalentSetFinder)field.GetValue(g1));
        }
Ejemplo n.º 9
0
        public void TestScenario()
        {
            IAtomContainer cid138898 = CID138898();
            IAtomContainer cid241107 = CID241107();

            IMoleculeHashGenerator basic = new HashGeneratorMaker().Depth(12).Elemental().Perturbed().Molecular();

            // basic equivalence method can't tell these apart
            Assert.AreEqual(basic.Generate(cid138898), basic.Generate(cid241107));

            IMoleculeHashGenerator cmplx = new HashGeneratorMaker().Depth(12).Elemental()
                                           .PerturbWith(new AllEquivalentCyclicSet()).Molecular();

            // complex equivalence method can tell these apart
            Assert.AreNotEqual(cmplx.Generate(cid138898), cmplx.Generate(cid241107));
        }
Ejemplo n.º 10
0
        public void TestScenario()
        {
            IAtomContainer cid4433798  = CID44333798();
            IAtomContainer cid57170558 = CID57170558();

            IMoleculeHashGenerator basic = new HashGeneratorMaker().Depth(12).Elemental().Perturbed().Molecular();

            // basic equivalence method can't tell these apart
            Assert.AreEqual(basic.Generate(cid4433798), basic.Generate(cid57170558));

            IMoleculeHashGenerator cmplx = new HashGeneratorMaker().Depth(12).Elemental()
                                           .PerturbWith(new MinimumEquivalentCyclicSetUnion()).Molecular();

            // complex equivalence method can tell these apart
            Assert.AreNotEqual(cmplx.Generate(cid4433798), cmplx.Generate(cid57170558));
        }
Ejemplo n.º 11
0
        public void TestEncode()
        {
            var m_e1 = new Mock <IAtomEncoder>(); var e1 = m_e1.Object;
            var m_e2 = new Mock <IAtomEncoder>(); var e2 = m_e2.Object;
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Encode(e1).Encode(e2).Atomic();
            var encoders = GetEncoders((BasicAtomHashGenerator)generator);

            Assert.AreEqual(2, encoders.Count);
            Assert.AreEqual(e1, encoders[0]);
            Assert.AreEqual(e2, encoders[1]);

            generator = new HashGeneratorMaker().Depth(0).Encode(e2).Encode(e1).Atomic();
            encoders  = GetEncoders((BasicAtomHashGenerator)generator);
            Assert.AreEqual(2, encoders.Count);
            Assert.AreEqual(e2, encoders[0]);
            Assert.AreEqual(e1, encoders[1]);
        }
Ejemplo n.º 12
0
        public void TestPerturbed()
        {
            IAtomHashGenerator g1 = new HashGeneratorMaker().Depth(0).Elemental().Perturbed().Atomic();

            Assert.IsTrue(g1 is PerturbedAtomHashGenerator);
        }
Ejemplo n.º 13
0
        public void TestChiral()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Depth(0).Elemental().Chiral().Atomic();

            Assert.AreNotEqual(StereoEncoderFactory.Empty, Encoder(generator));
        }
Ejemplo n.º 14
0
        public void SuppressHydrogens()
        {
            IAtomHashGenerator generator = new HashGeneratorMaker().Elemental().Depth(0).SuppressHydrogens().Atomic();

            Assert.IsInstanceOfType(generator, typeof(SuppressedAtomHashGenerator));
        }