Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tool filtering #118

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/fetch_all_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ jobs:
python -m pip install -r requirements.txt
sudo apt-get install jq
- name: Merge all tools
run: | #merge files with only one header -> https://stackoverflow.com/questions/16890582/unixmerge-multiple-csv-files-with-same-header-by-keeping-the-header-of-the-firs
run: | #merge files with only one header -> https://stackoverflow.com/questions/16890582/unixmerge-multiple-csv-files-with-same-header-by-keeping-the-header-of-the-firs; map(.[]) -> https://stackoverflow.com/questions/42011086/merge-arrays-of-json (get flat array, one tool per entry)
awk 'FNR==1 && NR!=1{next;}{print}' results/repositories*.list_tools.tsv > results/all_tools.tsv
jq -s '.' results/repositories*.list_tools.json > results/all_tools.json
jq -s 'map(.[])' results/repositories*.list_tools.json > results/all_tools.json
- name: Wordcloud and interactive table
run: |
bash ./bin/extract_all_tools_downstream.sh
Expand Down
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)
2 changes: 2 additions & 0 deletions bin/get_community_tools.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

# stop on error
set -e

for com_data_fp in data/communities/* ; do
if [[ -d "$com_data_fp" && ! -L "$com_data_fp" ]]; then
Expand Down