silterra commited on
Commit
40e4bad
1 Parent(s): 275b482

Change pocket center inputs to be text

Browse files
Files changed (1) hide show
  1. main.py +19 -4
main.py CHANGED
@@ -15,6 +15,20 @@ def run_wrapper(protein_file, ligand_file, other_args_file, *args) -> Tuple[str,
15
  if ligand_file is None:
16
  return "Ligand file is missing! Must provide a ligand file in SDF format", None, ""
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  other_args_dict = {}
19
  if other_args_file is not None:
20
  other_args_dict = yaml.safe_load(open(other_args_file['name'], "r"))
@@ -49,10 +63,11 @@ def run():
49
  elem_id="save_visualisation")
50
  with gr.Row():
51
  # Add fields for pocket_center_x, pocket_center_y, pocket_center_z
52
- pcx = gr.Number(label="Pocket Center X", value=None, precision=4, interactive=True)
53
- pcy = gr.Number(label="Pocket Center Y", value=None, precision=4, interactive=True)
54
- pcz = gr.Number(label="Pocket Center Z", value=None, precision=4, interactive=True)
55
- flex_sidechains = gr.Textbox(label="Flexible Sidechains", placeholder="A:130-B:140", value=None, interactive=True,
 
56
  info="Specify which amino acids will be flexible. E.g., A:130-B:140 will make amino acid with id 130 in chain A, and id 140 in chain B flexible.")
57
  with gr.Row():
58
  gr.Markdown("""Additional values can be included in "Other arguments", and will be passed
 
15
  if ligand_file is None:
16
  return "Ligand file is missing! Must provide a ligand file in SDF format", None, ""
17
 
18
+ float_locs = [-4, -3, -2]
19
+ num_centers = 0
20
+ for ii in float_locs:
21
+ av = args[ii]
22
+ if av is not None and av != "":
23
+ num_centers += 1
24
+ try:
25
+ tmp = float(args[ii])
26
+ except ValueError:
27
+ return f"Pocket Center value {args[ii]} is not a valid number", None, ""
28
+
29
+ if num_centers not in {0, 3}:
30
+ return "Either none or all three pocket center values must be provided", None, ""
31
+
32
  other_args_dict = {}
33
  if other_args_file is not None:
34
  other_args_dict = yaml.safe_load(open(other_args_file['name'], "r"))
 
63
  elem_id="save_visualisation")
64
  with gr.Row():
65
  # Add fields for pocket_center_x, pocket_center_y, pocket_center_z
66
+ pcx = gr.Text(label="Pocket Center X", placeholder="1.23", value=None, interactive=True)
67
+ pcy = gr.Text(label="Pocket Center Y", placeholder="4.56", value=None, interactive=True)
68
+ pcz = gr.Text(label="Pocket Center Z", placeholder="7.89", value=None, interactive=True)
69
+ flex_sidechains = gr.Textbox(label="Flexible Sidechains", placeholder="A:130-B:140", value=None,
70
+ interactive=True,
71
  info="Specify which amino acids will be flexible. E.g., A:130-B:140 will make amino acid with id 130 in chain A, and id 140 in chain B flexible.")
72
  with gr.Row():
73
  gr.Markdown("""Additional values can be included in "Other arguments", and will be passed