コード例 #1
0
        public void TestRawTanimotoBetween0and1()
        {
            var smilesParser  = CDK.SmilesParser;
            var mol1          = smilesParser.ParseSmiles("Cc1nc(C(=O)NC23CC4CC(CC(C4)C2)C3)c(C)n1C5CCCCC5");
            var mol2          = smilesParser.ParseSmiles("CS(=O)(=O)Nc1ccc(Cc2onc(n2)c3ccc(cc3)S(=O)(=O)Nc4ccc(CCNC[C@H](O)c5cccnc5)cc4)cc1");
            var fingerprinter = new SignatureFingerprinter(0);
            var fp1           = fingerprinter.GetRawFingerprint(mol1);
            var fp2           = fingerprinter.GetRawFingerprint(mol2);
            var tanimoto      = Tanimoto.Calculate(fp1, fp2);

            Assert.IsTrue(tanimoto > 0 && tanimoto < 1, $"Tanimoto expected to be between 0 and 1, was:{tanimoto}");
        }
コード例 #2
0
        public void CompareCountFingerprintAndRawFingerprintTanimoto()
        {
            var mol1          = TestMoleculeFactory.Make123Triazole();
            var mol2          = TestMoleculeFactory.MakeImidazole();
            var fingerprinter = new SignatureFingerprinter(1);
            var countFp1      = fingerprinter.GetCountFingerprint(mol1);
            var countFp2      = fingerprinter.GetCountFingerprint(mol2);
            var feat1         = fingerprinter.GetRawFingerprint(mol1);
            var feat2         = fingerprinter.GetRawFingerprint(mol2);
            var rawTanimoto   = Tanimoto.Calculate(feat1, feat2);
            var countTanimoto = Tanimoto.Method1(countFp1, countFp2);

            Assert.AreEqual(rawTanimoto, countTanimoto, 0.001);
        }