Skip to content

Instantly share code, notes, and snippets.

@mvdbeek
Last active April 9, 2020 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvdbeek/590213f65520c498321e1850ed8d44e6 to your computer and use it in GitHub Desktop.
Save mvdbeek/590213f65520c498321e1850ed8d44e6 to your computer and use it in GitHub Desktop.
Get tool ids that use (deprecated) tool shed packages
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