aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorPjotr Prins2024-03-24 09:36:33 +0100
committerFrederick Muriuki Muriithi2024-09-12 07:20:32 -0500
commit1c4286ec769bdea47c7950b905d78232366af1fe (patch)
tree79e4bf6a77cc77202eee662e573f7a477b02e904 /gn3/computations
parent090e5e0c41db2068d7e55684e320b287adc34bab (diff)
downloadgenenetwork3-1c4286ec769bdea47c7950b905d78232366af1fe.tar.gz
Change behavior of do_paths_exist to actually throw useful error
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/gemma.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/gn3/computations/gemma.py b/gn3/computations/gemma.py
index 03e1a76..5a2616b 100644
--- a/gn3/computations/gemma.py
+++ b/gn3/computations/gemma.py
@@ -1,4 +1,5 @@
"""Procedures related gemma computations"""
+import errno
import os
from base64 import b64encode
@@ -40,11 +41,14 @@ def generate_pheno_txt_file(trait_filename: str,
return f"{tmpdir}/gn2/{trait_filename}"
-def do_paths_exist(paths: ValuesView) -> bool:
- """Given a list of PATHS, return False if any of them do not exist."""
+def assert_paths_exist(paths: ValuesView) -> bool:
+ """Given a list of PATHS, throw error if any of them do not exist."""
for path in paths:
if not os.path.isfile(path):
- return False
+ if throw_error:
+ raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path)
+ else:
+ return False
return True