Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions openfecli/commands/plan_rbfe_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from openfecli import OFECommandPlugin
from openfecli.parameters import (
MOL_DIR, PROTEIN, MAPPER, OUTPUT_DIR, COFACTORS,
NEW_STORAGE_OUTPUT, # separate line for easy delete later
)
from openfecli.plan_alchemical_networks_utils import plan_alchemical_network_output

Expand Down Expand Up @@ -82,9 +83,11 @@ def plan_rbfe_network_main(
help=OUTPUT_DIR.kwargs["help"] + " Defaults to `./alchemicalNetwork`.",
default="alchemicalNetwork",
)
@NEW_STORAGE_OUTPUT.parameter()
@print_duration
def plan_rbfe_network(
molecules: List[str], protein: str, cofactors: tuple[str], output_dir: str
molecules: List[str], protein: str, cofactors: tuple[str],
output_dir: str, new_storage: bool,
):
"""
Plan a relative binding free energy network, saved as JSON files for
Expand Down Expand Up @@ -119,6 +122,8 @@ def plan_rbfe_network(
from openfe.setup.atom_mapping.lomap_scorers import (
default_lomap_score,
)
from openfe.storage.resultclient import ResultClient
from gufe.storage.externalresource import FileStorage
from openfe.setup import LomapAtomMapper
from openfe.setup.ligand_network_planning import (
generate_minimal_spanning_network,
Expand Down Expand Up @@ -175,12 +180,18 @@ def plan_rbfe_network(

# OUTPUT
write("Output:")
write("\tSaving to: " + str(output_dir))
plan_alchemical_network_output(
alchemical_network=alchemical_network,
ligand_network=ligand_network,
folder_path=OUTPUT_DIR.get(output_dir),
)
if new_storage:
write(f"Saving to: {output_dir}")
storage = ResultClient(FileStorage(output_dir))
storage.store_network(alchemical_network)
# TODO: save out the ligand network as well
else:
write("\tSaving to: " + str(output_dir))
plan_alchemical_network_output(
alchemical_network=alchemical_network,
ligand_network=ligand_network,
folder_path=OUTPUT_DIR.get(output_dir),
)


PLUGIN = OFECommandPlugin(
Expand Down
2 changes: 1 addition & 1 deletion openfecli/parameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
from .mol import MOL
from .mapper import MAPPER
from .output import OUTPUT_FILE_AND_EXT
from .output_dir import OUTPUT_DIR
from .output_dir import OUTPUT_DIR, NEW_STORAGE_OUTPUT
from .protein import PROTEIN
from .molecules import MOL_DIR, COFACTORS
7 changes: 7 additions & 0 deletions openfecli/parameters/output_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ def get_dir(user_input, context):
getter=get_dir,
type=click.Path(file_okay=False, resolve_path=True),
)

NEW_STORAGE_OUTPUT = Option(
"--new-storage",
help="use the new storage",
is_flag=True,
hidden=True,
)