diff options
author | Pjotr Prins | 2024-03-24 09:36:33 +0100 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-12 07:34:59 -0500 |
commit | bbca8fe96bd2176f300cab8746dace6fd2323320 (patch) | |
tree | 0ce8bd8defb2a1904d8c64b2fb792a140d7c7619 /gn3/computations | |
parent | 644100ea2e5e407eb06ccb292d85dd20b104beee (diff) | |
download | genenetwork3-bbca8fe96bd2176f300cab8746dace6fd2323320.tar.gz |
Change behavior of do_paths_exist to actually throw useful error
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/gemma.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gn3/computations/gemma.py b/gn3/computations/gemma.py index 2c367ff..f97fa6d 100644 --- a/gn3/computations/gemma.py +++ b/gn3/computations/gemma.py @@ -41,6 +41,17 @@ def generate_pheno_txt_file(trait_filename: str, return f"{tmpdir}/gn2/{trait_filename}" +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): + if throw_error: + raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) + else: + return False + return True + + # pylint: disable=R0913 def generate_gemma_cmd(gemma_cmd: str, output_dir: str, |