Ejemplo n.º 1
0
 def __init__(self, parameters: List[ComponentParameters], parallel=False):
     self.component_enum = ScoringFunctionComponentNameEnum()
     self.component_specific_parameters = ComponentSpecificParametersEnum()
     factory = ScoreComponentFactory(parameters)
     self.scoring_components = factory.create_score_components()
     if parallel:
         self.get_final_score = self._parallel_final_score
    def setUpClass(self):
        csp_enum = ComponentSpecificParametersEnum()
        transf_type = TransformationTypeEnum()
        sf_enum = ScoringFunctionComponentNameEnum()
        activity = create_activity_component_regression()
        activity.specific_parameters[
            csp_enum.TRANSFORMATION_TYPE] = transf_type.DOUBLE_SIGMOID
        activity.specific_parameters[csp_enum.COEF_DIV] = 100.
        activity.specific_parameters[csp_enum.COEF_SI] = 150.
        activity.specific_parameters[csp_enum.COEF_SE] = 150.
        off_activity = create_offtarget_activity_component_regression()

        delta_params = {
            "high": 3.0,
            "k": 0.25,
            "low": 0.0,
            "transformation": True,
            "transformation_type": "sigmoid"
        }

        selectivity = ComponentParameters(
            component_type=sf_enum.SELECTIVITY,
            name="desirability",
            weight=1.,
            smiles=[],
            model_path="",
            specific_parameters={
                "activity_model_path": activity.model_path,
                "offtarget_model_path": off_activity.model_path,
                "activity_specific_parameters":
                activity.specific_parameters.copy(),
                "offtarget_specific_parameters":
                off_activity.specific_parameters,
                "delta_transformation_parameters": delta_params
            })

        qed_score = ComponentParameters(component_type=sf_enum.QED_SCORE,
                                        name="qed_score",
                                        weight=1.,
                                        smiles=[],
                                        model_path="",
                                        specific_parameters={})
        matching_substructure = ComponentParameters(
            component_type=sf_enum.MATCHING_SUBSTRUCTURE,
            name="matching_substructure",
            weight=1.,
            smiles=["[*]n1cccc1CC"],
            model_path="",
            specific_parameters={})

        custom_alerts = create_custom_alerts_configuration()

        self.sf_state = CustomProduct(parameters=[
            activity, selectivity, qed_score, matching_substructure,
            custom_alerts
        ])
def _specific_parameters_classifiaction_predictive_model():
    csp_enum = ComponentSpecificParametersEnum()
    descriptor_types = DescriptorTypesEnum()
    specific_parameters = {csp_enum.HIGH: 9,
                           csp_enum.LOW: 4,
                           csp_enum.K: 0.25,
                           csp_enum.TRANSFORMATION: False,
                           csp_enum.SCIKIT: "classification",
                           csp_enum.DESCRIPTOR_TYPE: descriptor_types.ECFP_COUNTS}
    return specific_parameters
Ejemplo n.º 4
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     ts_parameters = ComponentParameters(
         component_type=sf_enum.MOLECULAR_WEIGHT,
         name="MW",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters={csp_enum.TRANSFORMATION: False})
     self.sf_state = CustomSum(parameters=[ts_parameters])
Ejemplo n.º 5
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     ts_parameters = ComponentParameters(
         component_type=sf_enum.NUM_HBD_LIPINSKI,
         name="NumHBD_Lipinski",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters={csp_enum.TRANSFORMATION: False})
     self.sf_state = CustomSum(parameters=[ts_parameters])
Ejemplo n.º 6
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     ts_parameters = ComponentParameters(
         component_type=sf_enum.NUM_ROTATABLE_BONDS,
         name="NumRotatableBonds",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters={csp_enum.TRANSFORMATION: False})
     self.sf_state = CustomSum(parameters=[ts_parameters])
def _specific_parameters_regression_predictive_model():
    csp_enum = ComponentSpecificParametersEnum()
    transf_type = TransformationTypeEnum()
    descriptor_types = DescriptorTypesEnum()
    specific_parameters = {csp_enum.HIGH: 9,
                           csp_enum.LOW: 4,
                           csp_enum.K: 0.25,
                           csp_enum.TRANSFORMATION: True,
                           csp_enum.TRANSFORMATION_TYPE: transf_type.SIGMOID,
                           csp_enum.SCIKIT: "regression",
                           csp_enum.DESCRIPTOR_TYPE: descriptor_types.ECFP_COUNTS}
    return specific_parameters
def create_offtarget_activity_component_classification():
    csp_enum = ComponentSpecificParametersEnum()
    sf_enum = ScoringFunctionComponentNameEnum()
    specific_parameters = _specific_parameters_classifiaction_predictive_model()
    specific_parameters[csp_enum.HIGH] = 3
    specific_parameters[csp_enum.LOW] = 0
    specific_parameters[csp_enum.TRANSFORMATION] = False
    parameters = ComponentParameters(component_type=sf_enum.PREDICTIVE_PROPERTY,
                                     name="predictive_property_classification",
                                     weight=1.,
                                     smiles=[],
                                     model_path=ACTIVITY_CLASSIFICATION,
                                     specific_parameters=specific_parameters)
    return parameters
def create_offtarget_activity_component_regression():
    csp_enum = ComponentSpecificParametersEnum()
    sf_enum = ScoringFunctionComponentNameEnum()
    specific_parameters = _specific_parameters_regression_predictive_model()
    specific_parameters[csp_enum.HIGH] = 3
    specific_parameters[csp_enum.LOW] = 0
    specific_parameters[csp_enum.TRANSFORMATION] = False
    parameters = ComponentParameters(component_type=sf_enum.PREDICTIVE_PROPERTY,
                                     name="offtarget_activity",
                                     weight=1.,
                                     smiles=[],
                                     model_path=OFFTARGET_ACTIVITY_REGRESSION,
                                     specific_parameters=specific_parameters)
    return parameters
def create_c_lab_component(somponent_type):
    csp_enum = ComponentSpecificParametersEnum()
    transf_type = TransformationTypeEnum()
    specific_parameters = {csp_enum.CLAB_INPUT_FILE: f"{MAIN_TEST_PATH}/clab_input.json",
                           csp_enum.HIGH: 9,
                           csp_enum.LOW: 4,
                           csp_enum.K: 0.25,
                           csp_enum.TRANSFORMATION: True,
                           csp_enum.TRANSFORMATION_TYPE: transf_type.SIGMOID}
    parameters = ComponentParameters(component_type=somponent_type,
                                     name="c_lab",
                                     weight=1.,
                                     smiles=[],
                                     model_path="",
                                     specific_parameters=specific_parameters)
    return parameters
Ejemplo n.º 11
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     tt_enum = TransformationTypeEnum()
     specific_parameters = {
         csp_enum.TRANSFORMATION: True,
         csp_enum.LOW: 0,
         csp_enum.HIGH: 1,
         csp_enum.TRANSFORMATION_TYPE: tt_enum.STEP
     }
     ts_parameters = ComponentParameters(
         component_type=sf_enum.NUM_HBD_LIPINSKI,
         name="NumHBD_Lipinski",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters=specific_parameters)
     self.sf_state = CustomSum(parameters=[ts_parameters])
Ejemplo n.º 12
0
 def setUp(self):
     self.rm_enums = RunningModeEnum()
     self.cs_enum = ComponentSpecificParametersEnum()
     self.tf_enum = TransformationTypeEnum()
     self.sfc_enum = ScoringFunctionComponentNameEnum()
     self.lm_enum = LoggingModeEnum()
     self.parameters = create_activity_component_regression()
     log_conf = BaseLoggerConfiguration(
         sender="http://10.59.162.10:8081",
         recipient=self.lm_enum.LOCAL,
         logging_path=f"{MAIN_TEST_PATH}/log",
         job_name="model_validation_test",
         job_id="1")
     self.configuration_envelope = GeneralConfigurationEnvelope(
         parameters=vars(self.parameters),
         logging=vars(log_conf),
         run_type=self.rm_enums.VALIDATION,
         version="2.0")
Ejemplo n.º 13
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     tt_enum = TransformationTypeEnum()
     specific_parameters = {
         csp_enum.TRANSFORMATION: True,
         csp_enum.LOW: 2,
         csp_enum.HIGH: 5,
         csp_enum.TRANSFORMATION_TYPE: tt_enum.STEP
     }
     ts_parameters = ComponentParameters(
         component_type=sf_enum.NUM_ROTATABLE_BONDS,
         name="NumRotatableBonds",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters=specific_parameters)
     self.sf_state = CustomSum(parameters=[ts_parameters])
Ejemplo n.º 14
0
    def setUpClass(cls):
        csp_enum = ComponentSpecificParametersEnum()
        transf_type = TransformationTypeEnum()
        enum = ScoringFunctionComponentNameEnum()

        delta_params = {
            "high": 3.0,
            "k": 0.25,
            "low": 0.0,
            "transformation": True,
            "transformation_type": "sigmoid"
        }
        activity = create_activity_component_classification()
        activity.specific_parameters[
            csp_enum.TRANSFORMATION_TYPE] = transf_type.DOUBLE_SIGMOID
        activity.specific_parameters[csp_enum.COEF_DIV] = 100.
        activity.specific_parameters[csp_enum.COEF_SI] = 150.
        activity.specific_parameters[csp_enum.COEF_SE] = 150.

        off_activity = create_offtarget_activity_component_classification()

        selectivity = ComponentParameters(
            component_type=enum.SELECTIVITY,
            name="desirability",
            weight=1.,
            smiles=[],
            model_path="",
            specific_parameters={
                "activity_model_path":
                activity.model_path,
                "offtarget_model_path":
                off_activity.model_path,
                "activity_specific_parameters":
                activity.specific_parameters.copy(),
                "offtarget_specific_parameters":
                off_activity.specific_parameters.copy(),
                "delta_transformation_parameters":
                delta_params
            })

        cls.component = SelectivityComponent(parameters=selectivity)
Ejemplo n.º 15
0
    def setUp(self):
        csp_enum = ComponentSpecificParametersEnum()
        ts_parameters = create_activity_component_regression()
        ts_parameters.specific_parameters[csp_enum.TRANSFORMATION] = False

        # unzip the model for loading
        if not os.path.isdir(MAIN_TEST_PATH):
            os.makedirs(MAIN_TEST_PATH)
        tmp_model_path = os.path.join(
            MAIN_TEST_PATH,
            os.path.splitext(os.path.basename(SAS_MODEL_PATH))[0])
        with gzip.open(SAS_MODEL_PATH, "rb") as f_in:
            with open(tmp_model_path, "wb") as f_out:
                shutil.copyfileobj(f_in, f_out)
        ts_parameters.model_path = tmp_model_path

        self.query_smiles = ['n1cccc2ccccc12']
        self.query_mols = [
            chem_smiles.to_mol(smile) for smile in self.query_smiles
        ]
        self.component = SASComponent(ts_parameters)
Ejemplo n.º 16
0
 def setUpClass(self):
     sf_enum = ScoringFunctionComponentNameEnum()
     csp_enum = ComponentSpecificParametersEnum()
     tt_enum = TransformationTypeEnum()
     specific_parameters = {
         csp_enum.TRANSFORMATION: True,
         csp_enum.LOW: 0,
         csp_enum.HIGH: 135,
         csp_enum.COEF_DIV: 100,
         csp_enum.COEF_SI: 200,
         csp_enum.COEF_SE: 200,
         csp_enum.TRANSFORMATION_TYPE: tt_enum.DOUBLE_SIGMOID
     }
     ts_parameters = ComponentParameters(
         component_type=sf_enum.TPSA,
         name="TPSA",
         weight=1.,
         smiles=[],
         model_path="",
         specific_parameters=specific_parameters)
     self.sf_state = CustomSum(parameters=[ts_parameters])
Ejemplo n.º 17
0
 def setUpClass(cls):
     cls.tt_enum = TransformationTypeEnum()
     cls.csp_enum = ComponentSpecificParametersEnum()
     cls.v_list = [12.086, 0.0015, 7.9, 123.264, 77.80, 4.0, 111.12]
Ejemplo n.º 18
0
 def __init__(self):
     self._csp_enum = ComponentSpecificParametersEnum()
     self._transformation_function_registry = self._default_transformation_function_registry(
     )
Ejemplo n.º 19
0
 def __init__(self, parameters: ComponentParameters):
     self.component_specific_parameters = ComponentSpecificParametersEnum()
     self.parameters = parameters
 def setUpClass(cls):
     cls.csp_enum = ComponentSpecificParametersEnum()
     activity = create_predictive_property_component_regression()
     cls.component = PredictivePropertyComponent(activity)