aboutsummaryrefslogtreecommitdiff
path: root/gn3/fs_helpers.py
diff options
context:
space:
mode:
authorArun Isaac2022-02-24 13:46:34 +0530
committerArun Isaac2022-02-24 14:04:06 +0530
commitaaff8b8ac968bce9821d6fef22b1296247a9df09 (patch)
tree87e7442b6f4114a64adeced052e3d3835b93a610 /gn3/fs_helpers.py
parent393700a432e25336c5afd1f008152202853f5bc2 (diff)
downloadgenenetwork3-aaff8b8ac968bce9821d6fef22b1296247a9df09.tar.gz
gn3: Explicitly specify UTF-8 to be the file encoding.
When the encoding is not specified explicitly, the system default encoding is used. This is not recommended. * gn3/computations/ctl.py (call_ctl_script), gn3/computations/gemma.py (generate_pheno_txt_file), gn3/computations/parsers.py (parse_genofile), gn3/computations/partial_correlations.py (partial_correlations_fast), gn3/computations/rqtl.py (process_rqtl_output, process_perm_output), gn3/computations/wgcna.py (dump_wgcna_data, call_wgcna_script), gn3/fs_helpers.py (jsonfile_to_dict): Explicitly specify UTF-8 to be the file encoding. * tests/unit/computations/test_gemma.py (TestGemma.test_generate_pheno_txt_file), tests/unit/computations/test_wgcna.py (TestWgcna.test_create_json_file): Test for call to open with encoding='utf-8' argument.
Diffstat (limited to 'gn3/fs_helpers.py')
-rw-r--r--gn3/fs_helpers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py
index 73f6567..578269b 100644
--- a/gn3/fs_helpers.py
+++ b/gn3/fs_helpers.py
@@ -41,7 +41,7 @@ def get_dir_hash(directory: str) -> str:
def jsonfile_to_dict(json_file: str) -> Dict:
"""Give a JSON_FILE, return a python dict"""
- with open(json_file) as _file:
+ with open(json_file, encoding="utf-8") as _file:
data = json.load(_file)
return data
raise FileNotFoundError