Exemple #1
0
def weird_physchem() -> GoalDirectedBenchmark:
    min_bertz = RdkitScoringFunction(descriptor=bertz,
                                     score_modifier=MaxGaussianModifier(
                                         mu=1500, sigma=200))

    mol_under_400 = RdkitScoringFunction(descriptor=mol_weight,
                                         score_modifier=MinGaussianModifier(
                                             mu=400, sigma=40))

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

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

    opt_weird = ArithmeticMeanScoringFunction(
        [min_bertz, mol_under_400, aroma, fluorine])

    specification = uniform_specification(1, 10, 100)

    return GoalDirectedBenchmark(name='Physchem MPO',
                                 objective=opt_weird,
                                 contribution_specification=specification)
Exemple #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])
Exemple #3
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],
    )
    def __init__(self, molecular_formula: str) -> None:
        """
        Args:
            molecular_formula: target molecular formula
        """
        super().__init__()

        element_occurrences = parse_molecular_formula(molecular_formula)

        total_number_atoms = sum(element_tuple[1] for element_tuple in element_occurrences)

        # scoring functions for each element
        self.functions = [RdkitScoringFunction(descriptor=AtomCounter(element),
                                               score_modifier=GaussianModifier(mu=n_atoms, sigma=1.0))
                          for element, n_atoms in element_occurrences]

        # scoring functions for the total number of atoms
        self.functions.append(RdkitScoringFunction(descriptor=num_atoms,
                                                   score_modifier=GaussianModifier(mu=total_number_atoms, sigma=2.0)))
    def determine_scoring_functions(
            molecular_formula: str) -> List[RdkitScoringFunction]:
        element_occurrences = parse_molecular_formula(molecular_formula)

        total_number_atoms = sum(element_tuple[1]
                                 for element_tuple in element_occurrences)

        # scoring functions for each element
        functions = [
            RdkitScoringFunction(descriptor=AtomCounter(element),
                                 score_modifier=GaussianModifier(mu=n_atoms,
                                                                 sigma=1.0))
            for element, n_atoms in element_occurrences
        ]

        # scoring functions for the total number of atoms
        functions.append(
            RdkitScoringFunction(descriptor=num_atoms,
                                 score_modifier=GaussianModifier(
                                     mu=total_number_atoms, sigma=2.0)))

        return functions