Example #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)
    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)
Example #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)
    # 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)
Example #3
0
def SPLIF_Fingerprint(ref_input, Listoflig, proteinpath):
    F_Scores = [0] * len(Listoflig)

    #protein = next(oddt.toolkit.readfile('pdb', proteinpath, removeHs=False, cleanupSubstructures=False, sanitize=False))
    try:
        protein = next(
            oddt.toolkit.readfile('pdb', proteinpath, removeHs=False))
        protein.protein = True
    except Exception as e:
        print(
            "Input structure could not be split into protein and ligand. Please check ligand identifier."
        )

        f2 = open(os.path.join(os.path.basename(proteinpath), 'ErrorLog.txt'),
                  'w')
        f2.write(str(e))
        f2.close()

    # Read in and define the reference ligand
    #ref_ligand = next(oddt.toolkit.readfile('pdb', ref_input, removeHs=False, cleanupSubstructures=False, sanitize=False))
    ref_ligand = next(oddt.toolkit.readfile('pdb', ref_input, removeHs=False))
    ref = fp.SPLIF(ref_ligand, protein)

    # Loop through each ligand in the list
    count = 0
    # print(Listoflig)
    for ligandpath in Listoflig:
        #ligand = next(oddt.toolkit.readfile('pdb', ligandpath, removeHs=False, cleanupSubstructures=False, sanitize=False))
        ligand = next(oddt.toolkit.readfile('pdb', ligandpath, removeHs=False))
        fp_query = fp.SPLIF(ligand, protein)
        # similarity score for current query
        F_Scores[count] = fp.similarity_SPLIF(ref, fp_query, rmsd_cutoff=3.)
        count = count + 1
    return F_Scores
Example #4
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)
Example #5
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.694,  0.639,  0.707,  0.657,  0.690,
                                   0.450,  0.702,  0.477,  0.576,  0.669,
                                   0.658,  0.714,  0.683,  0.585,  0.535,
                                   0.611,  0.554,  0.665,  0.697])
    else:
        target_outcome = np.array([0.694,  0.639,  0.707,  0.657,  0.690,
                                   0.467,  0.702,  0.485,  0.599,  0.669,
                                   0.658,  0.714,  0.683,  0.585,  0.535,
                                   0.611,  0.554,  0.665,  0.697])
    assert_array_almost_equal(outcome, target_outcome, decimal=3)