Skip to content

Commit

Permalink
allow empty or no tools_status file
Browse files Browse the repository at this point in the history
  • Loading branch information
paulzierep committed Jun 13, 2024
1 parent 7b65bef commit 15f77fd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/extract_galaxy_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,20 @@ def reduce_ontology_terms(terms: List, ontology: Any) -> List:
tools = json.load(f)
# get categories and tools to exclude
categories = read_file(args.categories)
status = pd.read_csv(args.status, sep="\t", index_col=0, header=None).to_dict("index")
try:
status = pd.read_csv(args.status, sep="\t", index_col=0, header=None).to_dict("index")
except Exception as ex:
print(f"Failed to load tool_status.tsv file with:\n{ex}")
print("Not assigning tool status for this community !")
status = {}

# filter tool lists
ts_filtered_tools, filtered_tools = filter_tools(tools, categories, status)

export_tools_to_tsv(ts_filtered_tools, args.ts_filtered_tools, format_list_col=True)
export_tools_to_tsv(filtered_tools, args.filtered_tools, format_list_col=True)

# if there are no filtered tools return the ts filtered tools
if filtered_tools:
export_tools_to_tsv(filtered_tools, args.filtered_tools, format_list_col=True)
else:
export_tools_to_tsv(ts_filtered_tools, args.filtered_tools, format_list_col=True)

0 comments on commit 15f77fd

Please sign in to comment.