about summary refs log tree commit diff
path: root/gn3/computations
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-08-31 06:56:35 +0300
committerMuriithi Frederick Muriuki2021-08-31 06:56:35 +0300
commit6c872943597f3664cca77abbdf56f074fc5231e6 (patch)
treede5232493c2337a969ee278e11bc1f8412b98f78 /gn3/computations
parent6ab866183aeac8553fdcda9217e4445da2b4836b (diff)
downloadgenenetwork3-6c872943597f3664cca77abbdf56f074fc5231e6.tar.gz
Fix bugs with `run_reaper` function
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi

* gn3/computations/qtlreaper.py: Fix some bugs
* qtlfilesexport.py: Test out running rust-qtlreaper

  Test out the qtlreaper interface code and fix some bugs caught in the
  process.
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/qtlreaper.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/gn3/computations/qtlreaper.py b/gn3/computations/qtlreaper.py
index 9b13a55..c058e14 100644
--- a/gn3/computations/qtlreaper.py
+++ b/gn3/computations/qtlreaper.py
@@ -42,7 +42,7 @@ def create_output_directory(path: str):
 
 def run_reaper(
         genotype_filename: str, traits_filename: str,
-        other_options: tuple = ("--n_permutations", 1000),
+        other_options: tuple = ("--n_permutations", "1000"),
         separate_nperm_output: bool = False,
         output_dir: str = TMPDIR):
     """
@@ -70,7 +70,7 @@ def run_reaper(
     The function will raise a `subprocess.CalledProcessError` exception in case
     of any errors running the `qtlreaper` command.
     """
-    create_output_directory(output_dir)
+    create_output_directory("{}/qtlreaper".format(output_dir))
     output_filename = "{}/qtlreaper/main_output_{}.txt".format(
         output_dir, random_string(10))
     output_list = ["--main_output", output_filename]
@@ -84,7 +84,9 @@ def run_reaper(
     command_list = [
         REAPER_COMMAND, "--geno", genotype_filename,
         *other_options, # this splices the `other_options` list here
-        "--traits", traits_filename, "--main_output", output_filename]
+        "--traits", traits_filename,
+        *output_list # this splices the `output_list` list here
+    ]
 
     subprocess.run(command_list, check=True)
     return (output_filename, permu_output_filename)