Пример #1
0
def test_splif_similarity():
    """SPLIF similarity"""
    mols = list(
        oddt.toolkit.readfile(
            'sdf',
            os.path.join(test_data_dir, 'data/dude/xiap/actives_docked.sdf')))
    mols = list(filter(lambda x: x.title == '312335', mols))
    list(map(lambda x: x.addh(only_polar=True), mols))
    receptor = next(
        oddt.toolkit.readfile(
            'pdb',
            os.path.join(test_data_dir, 'data/dude/xiap/receptor_rdkit.pdb')))
    receptor.protein = True
    receptor.addh(only_polar=True)
    # print(outcome)
    ref = SPLIF(mols[0], receptor)
    outcome = [similarity_SPLIF(ref, SPLIF(mol, receptor)) for mol in mols[1:]]
    if oddt.toolkit.backend == 'ob':
        target_outcome = np.array([
            0.751, 0.705, 0.76, 0.674, 0.745, 0.45, 0.754, 0.477, 0.614, 0.737,
            0.727, 0.772, 0.747, 0.585, 0.535, 0.681, 0.554, 0.736, 0.729
        ])
    else:
        target_outcome = np.array([
            0.751, 0.705, 0.76, 0.674, 0.745, 0.467, 0.754, 0.485, 0.637,
            0.737, 0.727, 0.772, 0.747, 0.585, 0.535, 0.681, 0.554, 0.736,
            0.729
        ])
    assert_array_almost_equal(outcome, target_outcome, decimal=3)
Пример #2
0
def test_splif_similarity():
    """SPLIF similarity"""
    mols = list(
        oddt.toolkit.readfile(
            'sdf',
            os.path.join(test_data_dir, 'data/dude/xiap/actives_docked.sdf')))
    mols = list(filter(lambda x: x.title == '312335', mols))
    list(map(lambda x: x.addh(only_polar=True), mols))
    receptor = next(
        oddt.toolkit.readfile(
            'pdb',
            os.path.join(test_data_dir, 'data/dude/xiap/receptor_rdkit.pdb')))
    receptor.protein = True
    receptor.addh(only_polar=True)
    ref = SPLIF(mols[0], receptor)
    splif_fps = [SPLIF(mol, receptor) for mol in mols]
    outcome = [similarity_SPLIF(ref, fp) for fp in splif_fps]
    target_outcome = np.array([
        1.000, 0.779, 0.660, 0.805, 0.630, 0.802, 0.366, 0.817, 0.378, 0.553,
        0.732, 0.705, 0.856, 0.797, 0.502, 0.418, 0.653, 0.436, 0.708, 0.688
    ])

    assert_array_almost_equal(outcome, target_outcome, decimal=3)

    # check if similarity is symmetric
    for fp1, fp2 in combinations(splif_fps, 2):
        assert similarity_SPLIF(fp1, fp2) == similarity_SPLIF(fp2, fp1)
Пример #3
0
def test_splif_similarity():
    """SPLIF similarity"""
    mols = list(
        oddt.toolkit.readfile(
            'sdf',
            os.path.join(test_data_dir, 'data/dude/xiap/actives_docked.sdf')))
    mols = list(filter(lambda x: x.title == '312335', mols))
    list(map(lambda x: x.addh(only_polar=True), mols))
    receptor = next(
        oddt.toolkit.readfile(
            'pdb',
            os.path.join(test_data_dir, 'data/dude/xiap/receptor_rdkit.pdb')))
    receptor.protein = True
    receptor.addh(only_polar=True)
    ref = SPLIF(mols[0], receptor)
    outcome = [similarity_SPLIF(ref, SPLIF(mol, receptor)) for mol in mols]
    if oddt.toolkit.backend == 'ob':
        target_outcome = np.array([
            1.000, 0.811, 0.690, 0.833, 0.654, 0.860, 0.373, 0.833, 0.389,
            0.550, 0.790, 0.771, 0.915, 0.851, 0.525, 0.436, 0.701, 0.479,
            0.743, 0.728
        ])
    else:
        target_outcome = np.array([
            1.000, 0.811, 0.690, 0.833, 0.654, 0.860, 0.387, 0.833, 0.394,
            0.572, 0.790, 0.771, 0.915, 0.851, 0.525, 0.436, 0.701, 0.479,
            0.743, 0.728
        ])

    assert_array_almost_equal(outcome, target_outcome, decimal=3)
Пример #4
0
def test_splif():
    """SPLIF fingerprints"""
    mols = list(oddt.toolkit.readfile('sdf', os.path.join(
        test_data_dir, 'data/dude/xiap/actives_docked.sdf')))
    mols = list(filter(lambda x: x.title == '312335', mols))
    list(map(lambda x: x.addh(only_polar=True), mols))
    receptor = next(oddt.toolkit.readfile('pdb', os.path.join(
        test_data_dir, 'data/dude/xiap/receptor_rdkit.pdb')))
    receptor.protein = True
    receptor.addh(only_polar=True)
    splif = SPLIF(mols[0], receptor)
    reference = [38, 53, 53, 53, 70, 81, 81, 125, 125, 127, 216, 219, 242,
                 249, 262, 262, 279, 279, 330, 396, 423, 423, 424, 498,
                 498, 570, 592, 622, 625, 626, 676, 676, 817, 818, 818,
                 818, 818, 884, 888, 895, 907, 914, 935, 1030, 1041, 1082,
                 1082, 1115, 1142, 1184, 1184, 1191, 1198, 1263, 1269,
                 1275, 1275, 1275, 1283, 1315, 1315, 1315, 1328, 1328,
                 1344, 1391, 1396, 1435, 1465, 1494, 1502, 1502, 1502,
                 1502, 1506, 1569, 1569, 1569, 1569, 1569, 1569, 1617,
                 1640, 1645, 1697, 1697, 1746, 1796, 1937, 1979, 1997,
                 2000, 2007, 2007, 2020, 2150, 2178, 2195, 2224, 2228,
                 2415, 2417, 2417, 2484, 2509, 2511, 2578, 2578, 2578,
                 2624, 2636, 2665, 2678, 2736, 2776, 2776, 2789, 2857,
                 2862, 2862, 2894, 2923, 2944, 2944, 3035, 3058, 3073,
                 3073, 3073, 3073, 3079, 3137, 3159, 3159, 3166, 3218,
                 3218, 3279, 3279, 3281, 3338, 3353, 3360, 3368, 3387,
                 3605, 3605, 3609, 3615, 3620, 3636, 3650, 3688, 3688,
                 3713, 3713, 3716, 3716, 3729, 3732, 3769, 3843, 3854,
                 3871, 3912, 3927, 3986, 3994, 3994, 4069, 4087, 4087]

    assert_equal(splif['hash'].shape, (172,))
    assert_array_equal(splif['ligand_coords'].shape, (172, 5, 3))
    assert_array_equal(splif['protein_coords'].shape, (172, 5, 3))
    assert_array_almost_equal(reference, splif['hash'], decimal=2)
Пример #5
0
def test_splif():
    """SPLIF fingerprints"""
    mols = list(
        oddt.toolkit.readfile(
            'sdf',
            os.path.join(test_data_dir, 'data/dude/xiap/actives_docked.sdf')))
    mols = list(filter(lambda x: x.title == '312335', mols))
    list(map(lambda x: x.addh(only_polar=True), mols))
    receptor = next(
        oddt.toolkit.readfile(
            'pdb',
            os.path.join(test_data_dir, 'data/dude/xiap/receptor_rdkit.pdb')))
    receptor.protein = True
    receptor.addh(only_polar=True)
    splif = SPLIF(mols[0], receptor)
    reference = [
        6, 38, 49, 53, 53, 53, 70, 70, 81, 81, 81, 81, 165, 216, 219, 249, 330,
        330, 333, 377, 380, 396, 396, 396, 423, 423, 479, 479, 498, 498, 498,
        570, 592, 625, 638, 768, 768, 817, 818, 818, 818, 818, 858, 884, 888,
        907, 930, 934, 935, 971, 1023, 1041, 1115, 1142, 1184, 1184, 1252,
        1263, 1269, 1275, 1275, 1275, 1315, 1315, 1315, 1337, 1337, 1344, 1351,
        1396, 1435, 1465, 1502, 1502, 1502, 1502, 1569, 1569, 1569, 1569, 1569,
        1569, 1569, 1569, 1640, 1645, 1660, 1660, 1697, 1697, 1716, 1746, 1756,
        1778, 1901, 1937, 1997, 2000, 2000, 2000, 2007, 2007, 2020, 2070, 2195,
        2274, 2294, 2319, 2415, 2417, 2509, 2528, 2578, 2578, 2584, 2590, 2590,
        2624, 2636, 2678, 2678, 2678, 2678, 2678, 2776, 2776, 2789, 2862, 2862,
        2894, 2894, 2894, 2923, 2923, 3058, 3073, 3073, 3073, 3073, 3137, 3159,
        3159, 3159, 3186, 3218, 3218, 3279, 3279, 3281, 3338, 3358, 3360, 3368,
        3387, 3609, 3636, 3636, 3713, 3713, 3716, 3716, 3748, 3767, 3769, 3854,
        3871, 3912, 3968, 3986, 3994, 3994, 4069
    ]

    assert splif['hash'].shape == (172, )
    assert_array_equal(splif['ligand_coords'].shape, (172, 7, 3))
    assert_array_equal(splif['protein_coords'].shape, (172, 7, 3))
    assert_array_equal(reference, splif['hash'])