Esempio n. 1
0
def hard_osimertinib() -> GoalDirectedBenchmark:
    smiles = 'COc1cc(N(C)CCN(C)C)c(NC(=O)C=C)cc1Nc2nccc(n2)c3cn(C)c4ccccc34'

    modifier = ClippedScoreModifier(upper_x=0.8)
    similar_to_osimertinib = TanimotoScoringFunction(smiles,
                                                     fp_type='FCFP4',
                                                     score_modifier=modifier)

    but_not_too_similar = TanimotoScoringFunction(
        smiles,
        fp_type='ECFP6',
        score_modifier=MinGaussianModifier(mu=0.85, sigma=0.1))

    tpsa_over_100 = RdkitScoringFunction(descriptor=tpsa,
                                         score_modifier=MaxGaussianModifier(
                                             mu=100, sigma=10))

    logP_scoring = RdkitScoringFunction(descriptor=logP,
                                        score_modifier=MinGaussianModifier(
                                            mu=1, sigma=1))

    make_osimertinib_great_again = ArithmeticMeanScoringFunction([
        similar_to_osimertinib, but_not_too_similar, tpsa_over_100,
        logP_scoring
    ])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Osimertinib MPO',
                                 objective=make_osimertinib_great_again,
                                 contribution_specification=specification)
Esempio n. 2
0
def start_pop_ranolazine() -> GoalDirectedBenchmark:
    ranolazine = 'COc1ccccc1OCC(O)CN2CCN(CC(=O)Nc3c(C)cccc3C)CC2'

    modifier = ClippedScoreModifier(upper_x=0.7)
    similar_to_ranolazine = TanimotoScoringFunction(ranolazine,
                                                    fp_type='AP',
                                                    score_modifier=modifier)

    logP_under_4 = RdkitScoringFunction(descriptor=logP,
                                        score_modifier=MaxGaussianModifier(
                                            mu=7, sigma=1))

    aroma = RdkitScoringFunction(descriptor=num_aromatic_rings,
                                 score_modifier=MinGaussianModifier(mu=1,
                                                                    sigma=1))

    fluorine = RdkitScoringFunction(descriptor=AtomCounter('F'),
                                    score_modifier=GaussianModifier(mu=1,
                                                                    sigma=1.0))

    optimize_ranolazine = ArithmeticMeanScoringFunction(
        [similar_to_ranolazine, logP_under_4, fluorine, aroma])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Ranolazine MPO',
                                 objective=optimize_ranolazine,
                                 contribution_specification=specification,
                                 starting_population=[ranolazine])
Esempio n. 3
0
def hard_cobimetinib() -> GoalDirectedBenchmark:
    smiles = 'OC1(CN(C1)C(=O)C1=C(NC2=C(F)C=C(I)C=C2)C(F)=C(F)C=C1)C1CCCCN1'

    modifier = ClippedScoreModifier(upper_x=0.7)
    os_tf = TanimotoScoringFunction(smiles,
                                    fp_type='FCFP4',
                                    score_modifier=modifier)
    os_ap = TanimotoScoringFunction(smiles,
                                    fp_type='ECFP6',
                                    score_modifier=MinGaussianModifier(
                                        mu=0.75, sigma=0.1))

    rot_b = RdkitScoringFunction(descriptor=num_rotatable_bonds,
                                 score_modifier=MinGaussianModifier(mu=3,
                                                                    sigma=1))

    rings = RdkitScoringFunction(descriptor=num_aromatic_rings,
                                 score_modifier=MaxGaussianModifier(mu=3,
                                                                    sigma=1))

    t_cns = ArithmeticMeanScoringFunction(
        [os_tf, os_ap, rot_b, rings,
         CNS_MPO_ScoringFunction()])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Cobimetinib MPO',
                                 objective=t_cns,
                                 contribution_specification=specification)
Esempio n. 4
0
def hard_fexofenadine() -> GoalDirectedBenchmark:
    """
    make fexofenadine less greasy
    :return:
    """
    smiles = 'CC(C)(C(=O)O)c1ccc(cc1)C(O)CCCN2CCC(CC2)C(O)(c3ccccc3)c4ccccc4'

    modifier = ClippedScoreModifier(upper_x=0.8)
    similar_to_fexofenadine = TanimotoScoringFunction(smiles,
                                                      fp_type='AP',
                                                      score_modifier=modifier)

    tpsa_over_90 = RdkitScoringFunction(descriptor=tpsa,
                                        score_modifier=MaxGaussianModifier(
                                            mu=90, sigma=10))

    logP_under_4 = RdkitScoringFunction(descriptor=logP,
                                        score_modifier=MinGaussianModifier(
                                            mu=4, sigma=1))

    optimize_fexofenadine = ArithmeticMeanScoringFunction(
        [similar_to_fexofenadine, tpsa_over_90, logP_under_4])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Fexofenadine MPO',
                                 objective=optimize_fexofenadine,
                                 contribution_specification=specification)
Esempio n. 5
0
def ranolazine_mpo() -> GoalDirectedBenchmark:
    """
    Make start_pop_ranolazine more polar and add a fluorine
    """
    ranolazine = "COc1ccccc1OCC(O)CN2CCN(CC(=O)Nc3c(C)cccc3C)CC2"

    modifier = ClippedScoreModifier(upper_x=0.7)
    similar_to_ranolazine = TanimotoScoringFunction(ranolazine,
                                                    fp_type="AP",
                                                    score_modifier=modifier)

    logP_under_4 = RdkitScoringFunction(descriptor=logP,
                                        score_modifier=MaxGaussianModifier(
                                            mu=7, sigma=1))

    tpsa_f = RdkitScoringFunction(descriptor=tpsa,
                                  score_modifier=MaxGaussianModifier(mu=95,
                                                                     sigma=20))

    fluorine = RdkitScoringFunction(descriptor=AtomCounter("F"),
                                    score_modifier=GaussianModifier(mu=1,
                                                                    sigma=1.0))

    optimize_ranolazine = GeometricMeanScoringFunction(
        [similar_to_ranolazine, logP_under_4, fluorine, tpsa_f])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(
        name="Ranolazine MPO",
        objective=optimize_ranolazine,
        contribution_specification=specification,
        starting_population=[ranolazine],
    )
Esempio n. 6
0
def scaffold_hop() -> GoalDirectedBenchmark:
    """
    Keep the decoration, and similarity to start point, but change the scaffold.
    """

    smiles = "CCCOc1cc2ncnc(Nc3ccc4ncsc4c3)c2cc1S(=O)(=O)C(C)(C)C"

    pharmacophor_sim = TanimotoScoringFunction(
        smiles,
        fp_type="PHCO",
        score_modifier=ClippedScoreModifier(upper_x=0.75))

    deco = SMARTSScoringFunction(
        "[#6]-[#6]-[#6]-[#8]-[#6]~[#6]~[#6]~[#6]~[#6]-[#7]-c1ccc2ncsc2c1",
        inverse=False)

    # anti scaffold
    scaffold = SMARTSScoringFunction(
        "[#7]-c1n[c;h1]nc2[c;h1]c(-[#8])[c;h0][c;h1]c12", inverse=True)

    scaffold_hop_obj = ArithmeticMeanScoringFunction(
        [pharmacophor_sim, deco, scaffold])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name="Scaffold Hop",
                                 objective=scaffold_hop_obj,
                                 contribution_specification=specification)
Esempio n. 7
0
def test_thresholded_is_special_case_of_clipped_for_positive_input():
    threshold = 4.584
    thresholded_modifier = ThresholdedLinearModifier(threshold=threshold)
    clipped_modifier = ClippedScoreModifier(upper_x=threshold)

    values = np.array([0, 2.3, 8.545, 3.23, 0.12, 55.555])

    assert np.allclose(thresholded_modifier(values), clipped_modifier(values))
Esempio n. 8
0
def similarity(smiles: str, name: str, fp_type: str = 'ECFP4', threshold: float = 0.7,
               rediscovery: bool = False) -> GoalDirectedBenchmark:
    category = 'rediscovery' if rediscovery else 'similarity'
    benchmark_name = f'{name} {category}'

    modifier = ClippedScoreModifier(upper_x=threshold)
    scoring_function = TanimotoScoringFunction(target=smiles, fp_type=fp_type, score_modifier=modifier)
    if rediscovery:
        specification = uniform_specification(1)
    else:
        specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name=benchmark_name,
                                 objective=scoring_function,
                                 contribution_specification=specification)
Esempio n. 9
0
def decoration_hop() -> GoalDirectedBenchmark:
    smiles = 'CCCOc1cc2ncnc(Nc3ccc4ncsc4c3)c2cc1S(=O)(=O)C(C)(C)C'

    pharmacophor_sim = TanimotoScoringFunction(smiles, fp_type='PHCO',
                                               score_modifier=ClippedScoreModifier(upper_x=0.85))
    # change deco
    deco1 = SMARTSScoringFunction('CS([#6])(=O)=O', inverse=True)
    deco2 = SMARTSScoringFunction('[#7]-c1ccc2ncsc2c1', inverse=True)

    # keep scaffold
    scaffold = SMARTSScoringFunction('[#7]-c1n[c;h1]nc2[c;h1]c(-[#8])[c;h0][c;h1]c12', inverse=False)

    deco_hop1_fn = ArithmeticMeanScoringFunction([pharmacophor_sim, deco1, deco2, scaffold])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Deco Hop',
                                 objective=deco_hop1_fn,
                                 contribution_specification=specification)
Esempio n. 10
0
def test_clipped_function():
    min_x = 4.4
    max_x = 8.8
    min_score = -3.3
    max_score = 9.2

    modifier = ClippedScoreModifier(upper_x=max_x, lower_x=min_x, high_score=max_score, low_score=min_score)

    # values smaller than min_x should be assigned min_score
    for x in [-2, 0, 4, 4.4]:
        assert modifier(x) == min_score

    # values larger than max_x should be assigned min_score
    for x in [8.8, 9.0, 1000]:
        assert modifier(x) == max_score

    # values in between are interpolated
    slope = (max_score - min_score) / (max_x - min_x)
    for x in [4.4, 4.8, 5.353, 8.034, 8.8]:
        dx = x - min_x
        dy = dx * slope
        assert modifier(x) == pytest.approx(min_score + dy)