From 0a91d8eee64a47062f03c3e04a015cf3ae96a782 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 24 Feb 2021 10:33:48 +0300 Subject: Add procedure that checks whether a list of paths exist --- gn3/computations/gemma.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gn3') 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 -- cgit v1.2.3