Skip to content

Commit

Permalink
Add microgalaxy wf tag and fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bebatut committed Oct 11, 2024
1 parent a5c95d3 commit d37af5e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
16 changes: 15 additions & 1 deletion communities/microgalaxy/metadata/workflow_tags
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
microgalaxy
name:microgalaxy
bacteria
bacterial-genomics
antimicrobial-resistance
metagenomics
virology
amr
microbiome
asaim
pathogfair
abromics
bacterial
microgalaxy
name:metatranscriptomics
name:amplicon
12 changes: 6 additions & 6 deletions sources/bin/extract_all_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

if [ ! -z $1 ]
then
python bin/extract_galaxy_workflows.py extract \
--all results/workflows.json \
--tools results/all_tools.json \
python sources/bin/extract_galaxy_workflows.py extract \
--all communities/all/resources/workflows.json \
--tools communities/all/resources/tools.json \
--test
else
python bin/extract_galaxy_workflows.py extract \
--all results/workflows.json \
--tools results/all_tools.json
python sources/bin/extract_galaxy_workflows.py extract \
--all communities/all/resources/workflows.json \
--tools communities/all/resources/tools.json
fi
14 changes: 8 additions & 6 deletions sources/bin/extract_galaxy_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ def add_workflows_from_workflowhub(self) -> None:
)
print(f"Workflows from WorkflowHub: {len(wfhub_wfs['data'])}")
data = wfhub_wfs["data"]
if self.test:
data = data[:1]
for wf in data:
wfhub_wf = shared.get_request_json(
f"https://workflowhub.eu{wf['links']['self']}",
Expand All @@ -158,6 +156,7 @@ def add_workflows_from_workflowhub(self) -> None:
wf = Workflow()
wf.init_from_search(wf=wfhub_wf, source="WorkflowHub", tools=self.tools)
self.workflows.append(wf)
print(len(self.workflows))

def add_workflows_from_a_server(self, server: str) -> None:
"""
Expand Down Expand Up @@ -193,7 +192,7 @@ def add_workflows_from_public_servers(self) -> None:
"https://usegalaxy.org.au",
]
if self.test:
server_urls = server_urls[:2]
server_urls = server_urls[2:3]
for url in server_urls:
print(url)
self.add_workflows_from_a_server(url)
Expand All @@ -208,10 +207,13 @@ def filter_workflows_by_tags(self, tags: list) -> None:
"""
Filter workflows by tags
"""
to_keep_wf = []
for w in self.workflows:
matches = set(w.tags) & set(tags)
if len(matches) == 0:
self.workflows.remove(w)
wf_tags = [w.lower() for w in w.tags]
matches = set(wf_tags) & set(tags)
if len(matches) != 0:
to_keep_wf.append(w)
self.workflows = to_keep_wf

def export_workflows_to_tsv(self, output_fp: str) -> None:
"""
Expand Down
32 changes: 16 additions & 16 deletions sources/bin/get_community_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

if [ ! -z $1 ]
then
python bin/extract_galaxy_workflows.py \
python sources/bin/extract_galaxy_workflows.py \
filter \
--all "results/workflows.json" \
--filtered "results/microgalaxy/test_workflows.tsv" \
--tags "data/communities/microgalaxy/workflow_tags"
--all "communities/all/resources/workflows.json" \
--filtered "communities/microgalaxy/resources/workflows.tsv" \
--tags "communities/microgalaxy/metadata/workflow_tags"

python bin/create_interactive_table.py \
--input "results/microgalaxy/workflows.tsv" \
--template "data/interactive_table_template.html" \
--output "results/microgalaxy/workflows.html"
python sources/bin/create_interactive_table.py \
--input "communities/microgalaxy/resources/workflows.tsv" \
--template "sources/data/interactive_table_template.html" \
--output "communities/microgalaxy/resources/workflows.html"

else
for com_data_fp in data/communities/* ; do
Expand All @@ -23,16 +23,16 @@ else
if [[ -f "data/communities/$community/workflow_tags" ]]; then
mkdir -p "results/$community/"

python bin/extract_galaxy_workflows.py \
python sources/bin/extract_galaxy_workflows.py \
filter \
--all "results/workflows.json" \
--filtered "results/$community/workflows.tsv" \
--tags "data/communities/$community/workflow_tags"
--all "communities/all/resources/workflows.json" \
--filtered "communities/$community/resources/workflows.tsv" \
--tags "communities/$community/metadata/workflow_tags"

python bin/create_interactive_table.py \
--input "results/$community/workflows.tsv" \
--template "data/interactive_table_template.html" \
--output "results/$community/workflows.html"
python sources/bin/create_interactive_table.py \
--input "communities/$community/resources/workflows.tsv" \
--template "sources/data/interactive_table_template.html" \
--output "communities/$community/resources/workflows.html"
fi;
fi;
done
Expand Down

0 comments on commit d37af5e

Please sign in to comment.