Skip to content

Commit

Permalink
Merge pull request #4 from BiomedSciAI/reactome_task_cli
Browse files Browse the repository at this point in the history
Changed the Reactome cli
  • Loading branch information
yoavkt authored Jun 18, 2024
2 parents ecb2039 + d875369 commit d53a9d0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/tasks_retrival/Reactome_tasks_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ def dump_to_task(task_dir, outcomes_df):
default="Pathways",
)
@click.option(
"--use-local-files",
"-l",
"--allow-downloads",
type=click.BOOL,
help="If false data files will be downloaded directly from HGNC and reactome, set to true only if you trust the urls above",
default=True,
default=False,
)
@click.option(
"--pathways-file",
Expand All @@ -100,17 +99,17 @@ def dump_to_task(task_dir, outcomes_df):
default="",
)
def main(
main_task_directory, task_name, use_local_files, pathways_file, top_pathways_file
main_task_directory, task_name, allow_downloads, pathways_file, top_pathways_file
):
if use_local_files:
df_path = pd.read_csv(pathways_file)
top_level = pd.read_csv(top_pathways_file)
else:
if allow_downloads:
symb_list = get_symbol_list()
token = get_token(symb_list)
url = f"https://reactome.org/AnalysisService/download/{token}/pathways/TOTAL/result.csv"
df_path = pd.read_csv(url, index_col="Pathway identifier")
top_level = get_top_level_pathway()
else:
df_path = pd.read_csv(pathways_file)
top_level = pd.read_csv(top_pathways_file)

top_in_file_paths = top_level.intersection(set(df_path.index))
df_path_top = df_path.loc[list(top_in_file_paths), :]
Expand Down

0 comments on commit d53a9d0

Please sign in to comment.