aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2022-12-13 00:34:11 +0300
committerGitHub2022-12-13 00:34:11 +0300
commitdf5860f127131a4601b54805f90b22a55479ba56 (patch)
treebdc2620b02cd97779213a066ff9ed80bb3512f12
parenta2796900a34056cfba2dfa4c995764ea60ff8e45 (diff)
downloadgenenetwork2-df5860f127131a4601b54805f90b22a55479ba56.tar.gz
add check for file in web/ProbeSetFreeze_DataMatrix folder (#758)
-rw-r--r--wqflask/wqflask/correlation/pre_computes.py15
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