Ejemplo n.º 1
0
        public void Method2()
        {
            ICountFingerprint fp1 = new IntArrayCountFingerprint(new Dictionary <string, int>()
            {
                { "A", 3 }
            });
            ICountFingerprint fp2 = new IntArrayCountFingerprint(new Dictionary <string, int>()
            {
                { "A", 4 }
            });

            Assert.AreEqual(0.75, Tanimoto.Method2(fp1, fp2), 0.001);
        }
        public void TestCompaRingBitFingerprintAndCountBehavingAsBit()
        {
            var mol1 = TestMoleculeFactory.Make123Triazole();
            var mol2 = TestMoleculeFactory.MakeImidazole();

            var fingerprinter          = new SignatureFingerprinter(1);
            ICountFingerprint countFp1 = fingerprinter.GetCountFingerprint(mol1);
            ICountFingerprint countFp2 = fingerprinter.GetCountFingerprint(mol2);

            countFp1.SetBehaveAsBitFingerprint(true);
            countFp2.SetBehaveAsBitFingerprint(true);
            var bitFp1         = fingerprinter.GetBitFingerprint(mol1);
            var bitFp2         = fingerprinter.GetBitFingerprint(mol2);
            var bitTanimoto    = Tanimoto.Calculate(bitFp1, bitFp2);
            var countTanimoto1 = Tanimoto.Method1(countFp1, countFp2);
            var countTanimoto2 = Tanimoto.Method2(countFp1, countFp2);

            Assert.AreEqual(countTanimoto1, countTanimoto2, 0.001);
            Assert.AreEqual(bitTanimoto, countTanimoto1, 0.001);
        }
        public void TestCountMethod1and2()
        {
            ICountFingerprint fp1 = new IntArrayCountFingerprint(new Dictionary <string, int>()
            {
                { "A", 3 }
            });
            ICountFingerprint fp2 = new IntArrayCountFingerprint(new Dictionary <string, int>()
            {
                { "A", 4 }
            });

            Assert.AreEqual(0.923, Tanimoto.Method1(fp1, fp2), 0.001);
            Assert.AreEqual(0.75, Tanimoto.Method2(fp1, fp2), 0.001);

            var mol1          = TestMoleculeFactory.MakeIndole();
            var mol2          = TestMoleculeFactory.MakeIndole();
            var fingerprinter = new SignatureFingerprinter();

            fp1 = fingerprinter.GetCountFingerprint(mol1);
            fp2 = fingerprinter.GetCountFingerprint(mol2);
            Assert.AreEqual(1.0, Tanimoto.Method1(fp1, fp2), 0.001);
            Assert.AreEqual(1.0, Tanimoto.Method2(fp1, fp2), 0.001);
        }