Last active
April 9, 2020 16:17
-
-
Save mvdbeek/590213f65520c498321e1850ed8d44e6 to your computer and use it in GitHub Desktop.
Get tool ids that use (deprecated) tool shed packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
# Exclude tool ids that contain these words | |
# I've checked them manually and they don't seem to use or reference python at all in the command section | |
to_exclude = {'bedtools', 'emboss', 'picard'} | |
api_key = os.environ['ADMIN_API_KEY'] | |
r = requests.get('https://usegalaxy.org/api/dependency_resolvers/toolbox', params={'key': api_key}) | |
deps = r.json() | |
tool_ids = [] | |
for d in deps: | |
for s in d['status']: | |
if s['dependency_type'] in ('tool_shed_package', 'galaxy_package'): | |
tool_ids.extend(d['tool_ids']) | |
python_tool_ids = [] | |
for d in deps: | |
for s in d['status']: | |
if s['dependency_type'] == 'tool_shed_package' and s['name'] == 'python': | |
python_tool_ids.extend(d['tool_ids']) | |
tool_ids = sorted(list(set(tool_ids) - set(python_tool_ids))) | |
tool_ids = [tid for tid in tool_ids if not any(exc in tid for exc in to_exclude)] | |
with open('tool_ids_that_use_packages', 'w') as out: | |
out.write("\n".join(tool_ids)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment