Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haddock3 restraints #732

Merged
merged 15 commits into from
Oct 26, 2023
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tox==3.24.5
pandas==1.5.1
plotly==5.11.0
kaleido==0.2.1
freesasa==2.2.0.post3
rvhonorato marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def read(*names, **kwargs) -> str:
'haddock3-unpack = haddock.clis.cli_unpack:maincli',
'haddock3-analyse = haddock.clis.cli_analyse:maincli',
'haddock3-traceback = haddock.clis.cli_traceback:maincli',
'haddock3-restraints = haddock.clis.cli_restraints:maincli'
]
},
# cmdclass={'build_ext': optional_build_ext},
Expand Down
79 changes: 79 additions & 0 deletions src/haddock/clis/cli_restraints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""
HADDOCK3 CLI for restraints-related tasks.

DISCLAIMER: these scripts have been ported from old code and are not
optimized for code quality and performance. They are provided as a convenience
for the user.

USAGE::

haddock3-restraints <TASK_NAME> <TASK_ARGS>

For the list of available tasks, run::

haddock3-restraints -h

For the list of arguments for a given task, run::

haddock3-restraints <TASK_NAME> -h
"""
import argparse
import sys

from haddock.restraints.restrain_bodies import add_restrain_bodies_arguments, restrain_bodies
from haddock.restraints.passive_from_active import add_pass_from_act_arguments, passive_from_active
from haddock.restraints.validate_tbl import add_validate_tbl_arguments, validate_tbl
from haddock.restraints.active_passive_to_ambig import add_actpass_to_ambig_arguments, actpass_to_ambig


# Command line interface parser
ap = argparse.ArgumentParser(
prog="haddock3-restraints",
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter,
)

subparsers = ap.add_subparsers(title='subcommands',
description='valid subcommands',
help='additional help')

# restrain_bodies subcommand
restrain_bodies_subcommand = subparsers.add_parser('restrain_bodies')
restrain_bodies_subcommand.set_defaults(func=restrain_bodies)
restrain_bodies_subcommand = add_restrain_bodies_arguments(restrain_bodies_subcommand)

# passive_from_active subcommand
pass_from_act_subcommand = subparsers.add_parser('passive_from_active')
pass_from_act_subcommand.set_defaults(func=passive_from_active)
pass_from_act_subcommand = add_pass_from_act_arguments(pass_from_act_subcommand)

# validate_tbl subcommand
validate_tbl_subcommand = subparsers.add_parser('validate_tbl')
validate_tbl_subcommand.set_defaults(func=validate_tbl)
validate_tbl_subcommand = add_validate_tbl_arguments(validate_tbl_subcommand)

# active_passive_to_ambig subcommand
actpass_to_ambig_subcommand = subparsers.add_parser('active_passive_to_ambig')
actpass_to_ambig_subcommand.set_defaults(func=actpass_to_ambig)
actpass_to_ambig_subcommand = add_actpass_to_ambig_arguments(actpass_to_ambig_subcommand)


def _ap():
return ap


def load_args(ap):
"""Load argument parser args."""
return ap.parse_args()


def maincli():
"""Execute main client."""
args = ap.parse_args()
cmd = vars(load_args(ap))
cmd.pop("func")
args.func(**cmd)


if __name__ == "__main__":
sys.exit(maincli())
Loading
Loading