aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/commands.py7
-rw-r--r--gn3/computations/rqtl.py25
2 files changed, 32 insertions, 0 deletions
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,
diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py
new file mode 100644
index 0000000..087a99f
--- /dev/null
+++ b/gn3/computations/rqtl.py
@@ -0,0 +1,25 @@
+"""Procedures related rqtl computations"""
+import os
+
+from typing import Dict
+from gn3.commands import compose_rqtl_cmd
+from gn3.fs_helpers import get_hash_of_files
+
+def generate_rqtl_cmd(rqtl_wrapper_cmd: str,
+ output_dir: str,
+ rqtl_wrapper_kwargs: Dict) -> Dict:
+
+ _hash = get_hash_of_files(
+ [v for k, v in rqtl_wrapper_kwargs.items() if k in ["g", "p", "addcovar",
+ "model", "method",
+ "interval", "nperm",
+ "scale", "control"]])
+
+ _output_filename = f"{_hash}-output.json"
+ return {
+ "output_file":
+ _output_filename,
+ "rqtl_cmd":
+ compose_rqtl_cmd(rqtl_wrapper_cmd=rqtl_wrapper_cmd,
+ rqtl_wrapper_kwargs=rqtl_wrapper_kwargs)
+ } \ No newline at end of file