diff options
author | BonfaceKilz | 2021-02-24 10:33:48 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-02-24 14:20:29 +0300 |
commit | 0a91d8eee64a47062f03c3e04a015cf3ae96a782 (patch) | |
tree | 16d84348583d8957fc622b595f0aa4194685bf65 /gn3/computations | |
parent | f3f05970ea4dfaf84fea52d8f4212e72ff21b3d0 (diff) | |
download | genenetwork3-0a91d8eee64a47062f03c3e04a015cf3ae96a782.tar.gz |
Add procedure that checks whether a list of paths exist
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/gemma.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gn3/computations/gemma.py b/gn3/computations/gemma.py index 42b4b36..ae04c40 100644 --- a/gn3/computations/gemma.py +++ b/gn3/computations/gemma.py @@ -6,6 +6,7 @@ import string from base64 import b64encode from hashlib import md5 from typing import List +from typing import ValuesView def generate_random_n_string(n_length: int) -> str: """Generate a random string that is N chars long""" @@ -41,3 +42,11 @@ def generate_pheno_txt_file(trait_filename: str, else: _file.write(f"{value}\n") 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.""" + for path in paths: + if not os.path.isfile(path): + return False + return True |