From 624ece086d026da9150cd35b2404874ccf607b07 Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 17 May 2021 21:56:51 +0000 Subject: Created compose_rqtl_command and generate_rqtl_command to create the actual command to be run from the command line; used the same pattern as for GEMMA for consistency --- gn3/commands.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gn3/commands.py') diff --git a/gn3/commands.py b/gn3/commands.py index 4b0d62d..db32d1f 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -30,6 +30,13 @@ def compose_gemma_cmd(gemma_wrapper_cmd: str = "gemma-wrapper", cmd += " ".join([f"{arg}" for arg in gemma_args]) return cmd +def compose_rqtl_cmd(rqtl_wrapper_cmd: str, + rqtl_wrapper_kwargs: Dict) -> str: + """Compose a valid R/qtl command given the correct input""" + cmd = rqtl_wrapper_cmd + " " + " ".join( + [f"--{key} {val}" for key, val in rqtl_wrapper_kwargs.items()]) + + return cmd def queue_cmd(conn: Redis, job_queue: str, -- cgit v1.2.3 From e61aa16f0bc3dd282060585e655e497fa3d06b49 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 18 May 2021 19:41:01 +0000 Subject: Account for boolean kwargs in compose_rqtl_cmd --- gn3/commands.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gn3/commands.py') diff --git a/gn3/commands.py b/gn3/commands.py index db32d1f..add715c 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -31,11 +31,18 @@ def compose_gemma_cmd(gemma_wrapper_cmd: str = "gemma-wrapper", return cmd def compose_rqtl_cmd(rqtl_wrapper_cmd: str, - rqtl_wrapper_kwargs: Dict) -> str: + rqtl_wrapper_kwargs: Dict, + rqtl_wrapper_bool_kwargs: list) -> str: """Compose a valid R/qtl command given the correct input""" + # Add kwargs with values cmd = rqtl_wrapper_cmd + " " + " ".join( [f"--{key} {val}" for key, val in rqtl_wrapper_kwargs.items()]) + # Add boolean kwargs (kwargs without values) + if len(rqtl_wrapper_bool_kwargs): + cmd += " " + cmd += " ".join([f"--{val}" for val in rqtl_wrapper_bool_kwargs]) + return cmd def queue_cmd(conn: Redis, -- cgit v1.2.3 From 36365588d95d96458da02090ebef21a02366784a Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 18 May 2021 19:49:44 +0000 Subject: Removed len from this if statement, since an empty list evaluates to False by itself --- gn3/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/commands.py') diff --git a/gn3/commands.py b/gn3/commands.py index add715c..255ea1d 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -39,7 +39,7 @@ def compose_rqtl_cmd(rqtl_wrapper_cmd: str, [f"--{key} {val}" for key, val in rqtl_wrapper_kwargs.items()]) # Add boolean kwargs (kwargs without values) - if len(rqtl_wrapper_bool_kwargs): + if rqtl_wrapper_bool_kwargs: cmd += " " cmd += " ".join([f"--{val}" for val in rqtl_wrapper_bool_kwargs]) -- cgit v1.2.3 From bf0a8cb22c0cc0c1dfe25740f88a4cb159dd0064 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 25 May 2021 20:27:33 +0000 Subject: Fix R/qtl command and the way keyword arguments are passed --- gn3/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3/commands.py') diff --git a/gn3/commands.py b/gn3/commands.py index 255ea1d..14bd295 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -35,10 +35,10 @@ def compose_rqtl_cmd(rqtl_wrapper_cmd: str, rqtl_wrapper_bool_kwargs: list) -> str: """Compose a valid R/qtl command given the correct input""" # Add kwargs with values - cmd = rqtl_wrapper_cmd + " " + " ".join( + cmd = f"Rscript { rqtl_wrapper_cmd } " + " ".join( [f"--{key} {val}" for key, val in rqtl_wrapper_kwargs.items()]) - # Add boolean kwargs (kwargs without values) + # Add boolean kwargs (kwargs that are either on or off, like --interval) if rqtl_wrapper_bool_kwargs: cmd += " " cmd += " ".join([f"--{val}" for val in rqtl_wrapper_bool_kwargs]) -- cgit v1.2.3