matanninio commited on
Commit
b64cfbe
1 Parent(s): 41a03fb

added proper support for name overide in Molnet tasks and a reasonable texts for the new tasks

Browse files
mammal_demo/__init__.py CHANGED
@@ -17,48 +17,71 @@ def tasks_and_models():
17
  # Note that the tasks need access to the models, as the model to use depends on the state of the widget
18
  # we pass the all_models dict and update it when we actualy have the models.
19
 
20
- ppi_task = all_tasks.register_task(PpiTask(model_dict=all_models))
21
- tdi_task = all_tasks.register_task(DtiTask(model_dict=all_models))
22
- ps_task = all_tasks.register_task(PsTask(model_dict=all_models))
23
- tcr_task = all_tasks.register_task(TcrTask(model_dict=all_models))
24
- bbbp_task = all_tasks.register_task(MolnetTask(model_dict=all_models,task_name="BBBP"))
25
- toxicity_task = all_tasks.register_task(MolnetTask(model_dict=all_models,task_name="TOXICITY"))
26
- fda_appr_task = all_tasks.register_task(MolnetTask(model_dict=all_models,task_name="FDA_APPR"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  # create the model holders. hold the model and the tokenizer, lazy download
29
  # note that the list of relevent tasks needs to be stated.
30
  all_models.register_model(
31
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd",
32
- task_list=[tdi_task],
33
  )
34
  all_models.register_model(
35
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd_peer",
36
- task_list=[tdi_task],
37
  )
38
 
39
  all_models.register_model(
40
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.tcr_epitope_bind",
41
- task_list=[tcr_task],
42
  )
43
  all_models.register_model(
44
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.protein_solubility",
45
- task_list=[ps_task],
46
  )
47
  all_models.register_model(
48
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m",
49
- task_list=[ppi_task],
50
  )
51
  all_models.register_model(
52
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_clintox_tox",
53
- task_list=[toxicity_task]
54
  )
55
  all_models.register_model(
56
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_clintox_fda",
57
- task_list=[fda_appr_task]
58
  )
59
  all_models.register_model(
60
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_bbbp",
61
- task_list=[bbbp_task],
62
  )
63
 
64
  return all_tasks,all_models
 
17
  # Note that the tasks need access to the models, as the model to use depends on the state of the widget
18
  # we pass the all_models dict and update it when we actualy have the models.
19
 
20
+ ppi_task_name = all_tasks.register_task(PpiTask(model_dict=all_models))
21
+ tdi_task_name = all_tasks.register_task(DtiTask(model_dict=all_models))
22
+ ps_task_name = all_tasks.register_task(PsTask(model_dict=all_models))
23
+ tcr_task_name = all_tasks.register_task(TcrTask(model_dict=all_models))
24
+ bbbp_task = MolnetTask(model_dict=all_models,task_name="BBBP", name= "Blood-Brain Barrier Penetration")
25
+ bbbp_task.markup_text = """
26
+ # Mammal based small molecule blood-brain barrier penetration demonstration
27
+
28
+ Given a drug (in SMILES), estimate the likelihood that it will penetrate the Blood-Brain Barrier.
29
+ """
30
+ bbbp_task_name = all_tasks.register_task(bbbp_task)
31
+
32
+ toxicity_task = MolnetTask(model_dict=all_models,task_name="TOXICITY", name= "Drug Toxicity Trials Failer")
33
+ toxicity_task.markup_text = """
34
+ # Mammal based small molecule toxicity trials failer estimation demonstration
35
+
36
+ Given a drug (in SMILES), estimate the likelihood that it will fail in clinical toxicity trials.
37
+ """
38
+ toxicity_task_name = all_tasks.register_task(toxicity_task)
39
+
40
+
41
+
42
+ fda_appr_task=MolnetTask(model_dict=all_models,task_name="FDA_APPR", name="drug FDA approval demonstration")
43
+ fda_appr_task.markup_text = """
44
+ # Mammal based small molecule drug FDA approval demonstration
45
+
46
+ Given a drug (in SMILES), estimate the likelihood that it will be approved by the FDA.
47
+ """
48
+ fda_appr_task_name = all_tasks.register_task(fda_appr_task)
49
+
50
 
51
  # create the model holders. hold the model and the tokenizer, lazy download
52
  # note that the list of relevent tasks needs to be stated.
53
  all_models.register_model(
54
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd",
55
+ task_list=[tdi_task_name],
56
  )
57
  all_models.register_model(
58
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.dti_bindingdb_pkd_peer",
59
+ task_list=[tdi_task_name],
60
  )
61
 
62
  all_models.register_model(
63
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.tcr_epitope_bind",
64
+ task_list=[tcr_task_name],
65
  )
66
  all_models.register_model(
67
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m.protein_solubility",
68
+ task_list=[ps_task_name],
69
  )
70
  all_models.register_model(
71
  model_path="ibm/biomed.omics.bl.sm.ma-ted-458m",
72
+ task_list=[ppi_task_name],
73
  )
74
  all_models.register_model(
75
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_clintox_tox",
76
+ task_list=[toxicity_task_name]
77
  )
78
  all_models.register_model(
79
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_clintox_fda",
80
+ task_list=[fda_appr_task_name]
81
  )
82
  all_models.register_model(
83
  "ibm/biomed.omics.bl.sm.ma-ted-458m.moleculenet_bbbp",
84
+ task_list=[bbbp_task_name],
85
  )
86
 
87
  return all_tasks,all_models
mammal_demo/molnet_task.py CHANGED
@@ -7,17 +7,18 @@ from mammal_demo.demo_framework import MammalObjectBroker, MammalTask
7
 
8
 
9
  class MolnetTask(MammalTask):
10
- def __init__(self, model_dict, task_name="BBBP"):
11
- super().__init__(name=f"Molnet: {task_name}", model_dict=model_dict)
 
 
12
  self.description = f"MOLNET {task_name}"
13
  self.examples = {
14
  "drug_seq": "CC(=O)NCCC1=CNc2c1cc(OC)cc2",
15
  }
16
  self.task_name=task_name
17
  self.markup_text = """
18
- # Mammal based Drug-Target binding affinity demonstration
19
 
20
- Given a protein sequence and a drug (in SMILES), estimate the binding affinity.
21
  """
22
 
23
  def crate_sample_dict(self, sample_inputs: dict, model_holder: MammalObjectBroker) -> dict:
 
7
 
8
 
9
  class MolnetTask(MammalTask):
10
+ def __init__(self, model_dict, task_name="BBBP", name=None):
11
+ if name is None:
12
+ name=f"Molnet: {task_name}"
13
+ super().__init__(name=name, model_dict=model_dict)
14
  self.description = f"MOLNET {task_name}"
15
  self.examples = {
16
  "drug_seq": "CC(=O)NCCC1=CNc2c1cc(OC)cc2",
17
  }
18
  self.task_name=task_name
19
  self.markup_text = """
20
+ # Mammal demonstration
21
 
 
22
  """
23
 
24
  def crate_sample_dict(self, sample_inputs: dict, model_holder: MammalObjectBroker) -> dict: