diff options
author | Frederick Muriuki Muriithi | 2022-01-05 09:43:41 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-01-10 08:33:19 +0300 |
commit | a7f5d93bec04b9142c8a14fb17a5059f069c6326 (patch) | |
tree | 39475af40f2b2830cbb464bc234fc0b1b9d9fdc1 /gn3/db | |
parent | 66310d955b2543c3f76ad2429b84c80bb9184f38 (diff) | |
download | genenetwork3-a7f5d93bec04b9142c8a14fb17a5059f069c6326.tar.gz |
Check for path existence
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi
Diffstat (limited to 'gn3/db')
-rw-r--r-- | gn3/db/correlations.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 5361a1e..d372607 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -29,8 +29,11 @@ def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[ filename = "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( tid=result[0], fname=result[1].replace(' ', '_').replace('/', '_')) - return ((filename in os.listdir(text_files_dir)) - and f"{text_files_dir}/{filename}") + full_filename = f"{text_files_dir}/{filename}" + return ( + os.path.exists(full_filename) and + (filename in os.listdir(text_files_dir)) and + full_filename) return False |