about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2025-01-23 13:56:25 +0300
committerBonfaceKilz2025-02-06 12:43:15 +0300
commitbdab517514d980ac4f1e5b350e5d9289f32cceb4 (patch)
tree75cf5c40e0e49a3d9d94bc144a14982770f6ef11
parentc708837c622645091ca4e34b2bf2e462052ab47d (diff)
downloadgenenetwork3-bdab517514d980ac4f1e5b350e5d9289f32cceb4.tar.gz
feat: Add function to compose an rqtl2 run command.
-rw-r--r--gn3/computations/rqtl2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gn3/computations/rqtl2.py b/gn3/computations/rqtl2.py
index 6e8e06a..bccedc0 100644
--- a/gn3/computations/rqtl2.py
+++ b/gn3/computations/rqtl2.py
@@ -49,3 +49,20 @@ def validate_required_keys(required_keys:list, data:dict) -> tuple[bool, str]:
         return False, f"Required key(s) missing: {', '.join(missing_keys)}"
     return True, ""
 
+
+def compose_rqtl2_cmd(rqtl_path, input_file,
+                      output_file, workspace_dir,
+                      data, config):
+    """Compose the command for running the R/QTL2 analysis."""
+    # pylint: disable=R0913
+    params = {
+        "input_file": input_file,
+        "directory": workspace_dir,
+        "output_file": output_file,
+        "nperm": data.get("nperm", 0),
+        "threshold": data.get("threshold", 1),
+        "cores": config.get('MULTIPROCESSOR_PROCS', 1)
+    }
+    rscript_path  = config.get("RSCRIPT", "Rscript")
+    return  f"{rscript_path} { rqtl_path } " + " ".join(
+        [f"--{key} {val}" for key, val in params.items()])