aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorzsloan2021-05-18 19:40:46 +0000
committerzsloan2021-05-18 19:40:46 +0000
commit74bc179807e80c1ee0f89cd98953263f68a05661 (patch)
tree883c2081dac3ed2e6bcfbe5d753869339888cb4c /gn3/computations
parent0a8754a582f057bd335441eab15da3f629df9ad7 (diff)
downloadgenenetwork3-74bc179807e80c1ee0f89cd98953263f68a05661.tar.gz
Fixed generate_rqtl_cmd to make the kwarg hash from a combination of keywords and arguments + account for boolean kwargs without values (like --interval or --covar)
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/rqtl.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py
index 0e8cd1f..855a819 100644
--- a/gn3/computations/rqtl.py
+++ b/gn3/computations/rqtl.py
@@ -2,24 +2,36 @@
from typing import Dict
from gn3.commands import compose_rqtl_cmd
+from gn3.computations.gemma import generate_hash_of_string
from gn3.fs_helpers import get_hash_of_files
def generate_rqtl_cmd(rqtl_wrapper_cmd: str,
- rqtl_wrapper_kwargs: Dict) -> Dict:
+ rqtl_wrapper_kwargs: Dict,
+ rqtl_wrapper_bool_kwargs: list) -> Dict:
"""Given the base rqtl_wrapper command and
dict of keyword arguments, return the full rqtl_wrapper command and an
output filename generated from a hash of the genotype and phenotype files
"""
+ # Generate a hash from contents of the genotype and phenotype files
_hash = get_hash_of_files(
[v for k, v in rqtl_wrapper_kwargs.items() if k in ["g", "p"]])
+ # Append to hash a hash of keyword arguments
+ _hash += generate_hash_of_string(
+ ",".join([f"{k}:{v}" for k, v in rqtl_wrapper_kwargs.items() if k not in ["g", "p"]]))
+
+ # Append to hash a hash of boolean keyword arguments
+ _hash += generate_hash_of_string(
+ ",".join(rqtl_wrapper_bool_kwargs))
+
_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)
+ rqtl_wrapper_kwargs=rqtl_wrapper_kwargs,
+ rqtl_wrapper_bool_kwargs=rqtl_wrapper_bool_kwargs)
}