OleinikovasV commited on
Commit
4a15a26
1 Parent(s): 5b72455

Update inference_app.py

Browse files
Files changed (1) hide show
  1. inference_app.py +2 -8
inference_app.py CHANGED
@@ -18,7 +18,6 @@ def generate_input_conformer(
18
  addHs: bool = False,
19
  minimize_maxIters: int = -1,
20
  ) -> Chem.Mol:
21
-
22
  _mol = Chem.MolFromSmiles(ligand_smiles)
23
  # need to add Hs to generate sensible conformers
24
  _mol = Chem.AddHs(_mol)
@@ -55,24 +54,19 @@ def generate_input_conformer(
55
 
56
 
57
  def optimize_coordinate(points, bound_buffer=15, dmin=6.05):
58
-
59
  bounds = list(
60
  zip(
61
  np.average(points, axis=0) - [bound_buffer]*3,
62
  np.average(points, axis=0) + [bound_buffer]*3
63
  )
64
  )
65
-
66
  # Define the constraint function (ensure dmin distance)
67
  con = NonlinearConstraint(lambda x: np.min(np.linalg.norm(points - x, axis=1)), dmin, 8)
68
-
69
  # Define the objective function (minimize pairwise distance)
70
  def objective(x):
71
  return np.sum(np.linalg.norm(points - x, axis=1))
72
-
73
  # Perform differential evolution to find the optimal coordinate
74
  result = differential_evolution(objective, bounds, constraints=con)
75
-
76
  return result.x, result.fun
77
 
78
 
@@ -96,12 +90,12 @@ def optimize_decoy_coordinate(points, bound_buffer=15, dmin=6.05, decoy_min=4.0,
96
 
97
  def add_decoy_atom(structure, decoy_pos):
98
  decoy = AtomArrayStack(length=1, depth=1)
99
- decoy.coord = np.ones_like(struct.coord) * decoy_pos
100
  decoy.chain_id = ["q"]
101
  decoy.element = ["C"]
102
  decoy.atom_name = ["C"]
103
  decoy.res_name = ["GLY"]
104
- return structure + struct
105
 
106
 
107
  def set_protein_to_new_coord_plus_decoy_atom(input_pdb_file, new_coord, decoy_coord, output_file):
 
18
  addHs: bool = False,
19
  minimize_maxIters: int = -1,
20
  ) -> Chem.Mol:
 
21
  _mol = Chem.MolFromSmiles(ligand_smiles)
22
  # need to add Hs to generate sensible conformers
23
  _mol = Chem.AddHs(_mol)
 
54
 
55
 
56
  def optimize_coordinate(points, bound_buffer=15, dmin=6.05):
 
57
  bounds = list(
58
  zip(
59
  np.average(points, axis=0) - [bound_buffer]*3,
60
  np.average(points, axis=0) + [bound_buffer]*3
61
  )
62
  )
 
63
  # Define the constraint function (ensure dmin distance)
64
  con = NonlinearConstraint(lambda x: np.min(np.linalg.norm(points - x, axis=1)), dmin, 8)
 
65
  # Define the objective function (minimize pairwise distance)
66
  def objective(x):
67
  return np.sum(np.linalg.norm(points - x, axis=1))
 
68
  # Perform differential evolution to find the optimal coordinate
69
  result = differential_evolution(objective, bounds, constraints=con)
 
70
  return result.x, result.fun
71
 
72
 
 
90
 
91
  def add_decoy_atom(structure, decoy_pos):
92
  decoy = AtomArrayStack(length=1, depth=1)
93
+ decoy.coord = np.ones_like(decoy.coord) * decoy_pos
94
  decoy.chain_id = ["q"]
95
  decoy.element = ["C"]
96
  decoy.atom_name = ["C"]
97
  decoy.res_name = ["GLY"]
98
+ return structure + decoy
99
 
100
 
101
  def set_protein_to_new_coord_plus_decoy_atom(input_pdb_file, new_coord, decoy_coord, output_file):