Skip to content

Instantly share code, notes, and snippets.

@pansapiens
Created August 17, 2022 02:29
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 pansapiens/ec8a5ed18eebf2970f7c34a9a473ec7e to your computer and use it in GitHub Desktop.
Save pansapiens/ec8a5ed18eebf2970f7c34a9a473ec7e to your computer and use it in GitHub Desktop.
Grab the latest Singularity container for a bioconda package
#!/bin/bash
#
# ./get_latest_container.sh
# Given a bioconda package name as the first argument, downloads
# the most recent corresponding Singularity image from quay.io/biocontainers
#
# Usage:
#
# ./get_latest_container.sh <package_name>
#
# Requires: python, curl, singularity
PACKAGE=$1
URL="https://quay.io/api/v1/repository/biocontainers/${PACKAGE}/tag/?limit=1&page=1&onlyActiveTags=true"
TAG=$(curl -H 'Content-Type: application/json' "${URL}" | python -c "import sys, json; print(json.loads(sys.stdin.read())['tags'][0]['name'])")
singularity pull "docker://quay.io/biocontainers/${PACKAGE}:${TAG}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment