diff --git a/run_af2/bin/submit-af2 b/run_af2/bin/submit-af2 index e2465b621fadf22804664dc79570affc5610a628..9b19a76c3fc9a639f67707f941bc630405de3bbe 100755 --- a/run_af2/bin/submit-af2 +++ b/run_af2/bin/submit-af2 @@ -27,7 +27,7 @@ # handle command line arguments if test $# -lt 2; then echo "usage: submit-af2 [--use-gpu]" - echo " [--preset {reduced_dbs,full_dbs}]" + echo " [--db-preset {reduced_dbs,full_dbs}]" echo " [--max-template-date YYYY-MM-DD]" echo " <OUTPUT DIR> <FASTA FILE> [<FASTA FILE> ...]" exit 1 @@ -41,9 +41,9 @@ for i in 1 2 3; do shift SLURM_AF_PARAMS="--partition=a100,rtx8000 --gres=gpu:1" AF_PIPELINE_PARAM="${AF_PIPELINE_PARAM} --use-gpu" - else if test x"${1}" = x"--preset"; then + else if test x"${1}" = x"--db-preset"; then shift - AF_PIPELINE_PARAM="${AF_PIPELINE_PARAM} --preset ${1}" + AF_PIPELINE_PARAM="${AF_PIPELINE_PARAM} --db-preset ${1}" shift else if test x"${1}" = x"--max-template-date"; then shift diff --git a/run_af2/src/run_af2/_shared.py b/run_af2/src/run_af2/_shared.py index 3eb505642585715f5eb91f955366768060951da2..0995ccbe8ecdbaac3c5c68846fe8e7e9ac54fa44 100644 --- a/run_af2/src/run_af2/_shared.py +++ b/run_af2/src/run_af2/_shared.py @@ -58,7 +58,7 @@ def parse_af2_arguments(parser): :returns: :class:`argparse.Namespace` object from `argparse.ArgumentParser.parse_args`. """ - preset_choices = { + db_preset_choices = { "reduced_dbs": ["bfd_database_path", "uniclust30_database_path"], "full_dbs": ["small_bfd_database_path"], } @@ -102,8 +102,8 @@ def parse_af2_arguments(parser): ) af2_group.add_argument( "-p", - "--preset", - choices=preset_choices.keys(), + "--db-preset", + choices=db_preset_choices.keys(), help="Choose model configuration - no ensembling and smaller genetic " + "databases (reduced_dbs), no ensembling and full genetic databases " + "configuration (full_dbs), the casp14 preset is not available right " @@ -113,7 +113,7 @@ def parse_af2_arguments(parser): af2_group.add_argument( "--version", action="version", - version="%(prog)s {}".format(get_version()), + version=f"{get_version()}", help="Show the version number and exit.", ) af2_group.add_argument( @@ -149,7 +149,7 @@ def parse_af2_arguments(parser): "--small-bfd-database-path", type=str, help="Path to the small version of the BFD database, used with " - + "'--preset reduced_dbs'.", + + "'--db-preset reduced_dbs'.", metavar="<PATH/ PREFIX>", default=None, ) @@ -190,11 +190,11 @@ def parse_af2_arguments(parser): ) opts = parser.parse_args() - # check that the preset setting makes sense - for arg in preset_choices[opts.preset]: + # check that the db_preset setting makes sense + for arg in db_preset_choices[opts.db_preset]: if getattr(opts, arg) is not None: print( - f"WARNING: '--preset {opts.preset}' disables use of " + f"WARNING: '--db-preset {opts.db_preset}' disables use of " + f"'--{(arg).replace('_', '-')}'.", file=sys.stderr, flush=True, diff --git a/run_af2/src/run_af2/run_singularity.py b/run_af2/src/run_af2/run_singularity.py index 9a6e639e2fb825e17a8ee5d252dda0606341efa8..6beef8689c42b509aae9ecedc65cd63377ac1c2d 100644 --- a/run_af2/src/run_af2/run_singularity.py +++ b/run_af2/src/run_af2/run_singularity.py @@ -115,7 +115,7 @@ def _assemble_singularity_call( # pylint: disable=too-many-arguments tmpdir, binds, use_gpu, - preset, + db_preset, data_paths, ): """Assemble the command to run AF2 from the Singularity image.""" @@ -147,7 +147,7 @@ def _assemble_singularity_call( # pylint: disable=too-many-arguments f"--output_dir={snglrty_out}", f"--model_names={','.join(model_names)}", f"--max_template_date={max_template_date}", - f"--preset={preset}", + f"--db_preset={db_preset}", "--logtostderr", ] ) @@ -188,7 +188,7 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments max_template_date=None, model_names=None, use_gpu=False, - preset="full_dbs", + db_preset="full_dbs", af2_image_file=None, # "/export/soft/singularity-containers/alphafold", af2_image_dir="/scicore/home/schwede/GROUP/alphafold_data/", @@ -236,11 +236,11 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments :type model_names: :class:`list` of :class:`str` :param use_gpu: Run the AF2 pipeline using GPUs or not. :type use_gpu: :class:`bool` - :param preset: Model configuration - no ensembling and smaller genetic - databases (reduced_dbs), no ensembling and full genetic - databases configuration (full_dbs). Corresponds to the preset - parameter in AF2. - :type preset: :class:`str` + :param db_preset: Model configuration - no ensembling and smaller genetic + databases (reduced_dbs), no ensembling and full genetic + databases configuration (full_dbs). Corresponds to the + preset parameter in AF2. + :type db_preset: :class:`str` :param af2_image_file: Declare a Singularity image to run the AF2 pipeline from. If None, an image from af2_image_dir will be used. @@ -269,9 +269,10 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments bfd_database_path in AF2. :type bfd_database_path: :class:`str` :param small_bfd_database_path: Small BFD database path, used with - preset="reduced_dbs", not a HHblits prefix - as for the large BFD database. Corresponds to - small_bfd_database_path in AF2. + db_preset="reduced_dbs", not a HHblits + prefix as for the large BFD database. + Corresponds to small_bfd_database_path in + AF2. :type small_bfd_database_path: :class:`str` :param uniclust30_database_path: Uniclust30 database prefix. Corresponds to uniclust30_database_path in AF2. @@ -298,9 +299,9 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments tmpdir = os.getenv(tmpdir_var) if tmpdir is None: raise ValueError(f"tmpdir_var {tmpdir_var} must not be empty.") - if preset not in ["full_dbs", "reduced_dbs"]: + if db_preset not in ["full_dbs", "reduced_dbs"]: raise ValueError( - f"preset {preset} not allowed, known values: " + f"db_preset {db_preset} not allowed, known values: " + "'full_dbs', 'reduced_dbs'" ) @@ -313,10 +314,10 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments "template_mmcif_dir": template_mmcif_dir, "obsolete_pdbs_path": obsolete_pdbs_path, } - if preset == "full_dbs": + if db_preset == "full_dbs": data_paths["bfd_database_path"] = bfd_database_path data_paths["uniclust30_database_path"] = uniclust30_database_path - elif preset == "reduced_dbs": + elif db_preset == "reduced_dbs": data_paths["small_bfd_database_path"] = small_bfd_database_path # Collect bind mountpoints for singularity, mountpoints for input data plus @@ -344,7 +345,7 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments tmpdir, binds, use_gpu, - preset, + db_preset, data_paths, ) @@ -369,7 +370,7 @@ def run_af2_singularity_image( # pylint: disable=too-many-arguments if proc.returncode: raise RuntimeError( "Singularity/ AF2 did not finish successfully, " - + "exit code: %d" % proc.returncode, + + f"exit code: {proc.returncode}", proc.returncode, ) @@ -407,7 +408,7 @@ def main(): opts.max_template_date, opts.model_names, opts.use_gpu, - opts.preset, + opts.db_preset, af2_image_file=opts.singularity_image, **data_paths, )