Skip to content

Commit

Permalink
Merge pull request #732 from haddocking/haddock3_restraints
Browse files Browse the repository at this point in the history
Haddock3 restraints
  • Loading branch information
mgiulini committed Oct 26, 2023
2 parents 1e307a0 + d260fc6 commit c77f949
Show file tree
Hide file tree
Showing 10 changed files with 1,134 additions and 0 deletions.
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
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

0 comments on commit c77f949

Please sign in to comment.