From 119f5419bd309a93946d989b1fedc5d75ccaa6b8 Mon Sep 17 00:00:00 2001 From: abearab Date: Sun, 23 Jun 2024 02:16:06 -0700 Subject: [PATCH] mend --- CanDI/setup/manager.py | 50 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/CanDI/setup/manager.py b/CanDI/setup/manager.py index 84ca218..5d10f88 100644 --- a/CanDI/setup/manager.py +++ b/CanDI/setup/manager.py @@ -67,34 +67,30 @@ def download_reformatted_data(self): if not os.path.exists(self.manager_path + '/data/depmap/'): os.makedirs(self.manager_path + '/data/depmap/') - if self.download_source == "dataverse": - urls, file_names = depmap_dataverse_download( - self.manager_path + '/data/depmap/', - return_type= ["url", "name"] - ) - - depmap_urls = { - file: url for url, file in zip(urls, file_names) - } - - depmap_files = {} - for file in file_names: - f_key = file.split('.')[0] - f_key = f_key.replace('CCLE_','') - f_key = f_key.replace('CRISPR_','') - depmap_files[f_key] = file - - formatted = { - f'{self.manager_path}/data/depmap/{file}': file for file in file_names - if 'readme' not in file.lower() - } - - self.parser["depmap_urls"] = depmap_urls - self.parser["depmap_files"] = depmap_files - self.parser["formatted"] = formatted + urls, file_names = depmap_dataverse_download( + self.manager_path + '/data/depmap/', + return_type= ["url", "name"] + ) - else: - raise RuntimeError("Set download source to 'dataverse' before running download_formated_data") + depmap_urls = { + file: url for url, file in zip(urls, file_names) + } + + depmap_files = {} + for file in file_names: + f_key = file.split('.')[0] + f_key = f_key.replace('CCLE_','') + f_key = f_key.replace('CRISPR_','') + depmap_files[f_key] = file + + formatted = { + f'{self.manager_path}/data/depmap/{file}': file for file in file_names + if 'readme' not in file.lower() + } + + self.parser["depmap_urls"] = depmap_urls + self.parser["depmap_files"] = depmap_files + self.parser["formatted"] = formatted class BroadDepMap(Manager):