diff options
author | Alexander Kabui | 2022-12-13 00:34:11 +0300 |
---|---|---|
committer | GitHub | 2022-12-13 00:34:11 +0300 |
commit | df5860f127131a4601b54805f90b22a55479ba56 (patch) | |
tree | bdc2620b02cd97779213a066ff9ed80bb3512f12 | |
parent | a2796900a34056cfba2dfa4c995764ea60ff8e45 (diff) | |
download | genenetwork2-df5860f127131a4601b54805f90b22a55479ba56.tar.gz |
add check for file in web/ProbeSetFreeze_DataMatrix folder (#758)
-rw-r--r-- | wqflask/wqflask/correlation/pre_computes.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/wqflask/wqflask/correlation/pre_computes.py b/wqflask/wqflask/correlation/pre_computes.py index 37f037a7..9ffbebf6 100644 --- a/wqflask/wqflask/correlation/pre_computes.py +++ b/wqflask/wqflask/correlation/pre_computes.py @@ -174,16 +174,23 @@ def get_datasets_data(base_dataset, target_dataset_data): def fetch_text_file(dataset_name, conn, text_dir=TMPDIR): """fetch textfiles with strain vals if exists""" + + def __file_scanner__(text_dir,target_file): + for file in os.listdir(text_dir): + if file.startswith(f"ProbeSetFreezeId_{results[0]}_"): + return os.path.join(text_dir,file) + with conn.cursor() as cursor: cursor.execute( 'SELECT Id, FullName FROM ProbeSetFreeze WHERE Name = %s', (dataset_name,)) results = cursor.fetchone() if results: try: - for file in os.listdir(text_dir): - if file.startswith(f"ProbeSetFreezeId_{results[0]}_"): - return os.path.join(text_dir, file) - except FileNotFoundError: + # addition check for matrix file in gn_matrix folder + + return __file_scanner__(text_dir,results) or __file_scanner__(TEXTDIR,results) + + except Exception: pass |