Skip to content

Commit

Permalink
Add option to write vina-style fridbox text file
Browse files Browse the repository at this point in the history
  • Loading branch information
althea-hansel committed Jan 4, 2024
1 parent 7fd2f24 commit 5cb385b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions meeko/gridbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,11 @@ def calc_box(coord_array, padding):
size_z = z_max - z_min + 2 * padding
return (center_x, center_y, center_z), (size_x, size_y, size_z)

def box_to_vina_string(gridcenter, gridsizes):
dims = ['x', 'y', 'z']
centers_str = "\n".join([f"center_{d} = {gridcenter[i]}" for i, d in enumerate(dims)])
sizes_str = "\n".join([f"size_{d} = {gridsizes[i]}" for i, d in enumerate(dims)])
return centers_str + "\n" + sizes_str

boron_silicon_atompar = "atom_par Si 4.10 0.200 35.8235 -0.00143 0.0 0.0 0 -1 -1 6" + os_linesep
boron_silicon_atompar += "atom_par B 3.84 0.155 29.6478 -0.00152 0.0 0.0 0 -1 -1 0" + os_linesep
9 changes: 9 additions & 0 deletions scripts/mk_prepare_receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def get_args():
box_group.add_argument('--box_center_on_reactive_res', help="project center of grid box along CA-CB bond 5 A away from CB", action="store_true")
box_group.add_argument('--ligand', help="Reference ligand file path: .sdf, .mol, .mol2, .pdb, and .pdbqt files accepted")
box_group.add_argument('--padding', help="padding around reference ligand [A]", type=float)
box_group.add_argument('--write_vinabox', help='Write vina-style gridbox file', action='store_true')


#reactive_group = parser.add_argument_group("Reactive")
Expand Down Expand Up @@ -471,6 +472,14 @@ def get_args():
with open(box_fn, "w") as f:
f.write(gridbox.box_to_pdb_string(box_center, npts))

# write gridbox vina format
if args.write_vinabox:
box_vina_fn = pathlib.Path(rigid_fn).with_suffix("_box.txt")
written_files_log["filename"].append(box_vina_fn)
written_files_log["description"].append("Vina-style box dimension file")
with open(box_vina_fn, "w") as f:
f.write(gridbox.box_to_vina_string(box_center, box_size))

# check all flexres are inside the box
if len(reactive_flexres) > 0:
any_outside = False
Expand Down

0 comments on commit 5cb385b

Please sign in to comment.