Skip to content
Snippets Groups Projects
Commit 6d289167 authored by Bienchen's avatar Bienchen
Browse files

Change preset to db[-_]preset.

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