BioBlend

1.9.0 · active · verified Thu Apr 16

BioBlend is a Python library for interacting with the Galaxy API. It simplifies scripting and automating Galaxy analyses, as well as administering a Galaxy server. The library supports Python 3.10 - 3.14 and Galaxy release 19.05 and later. It is actively developed and maintained, with regular releases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to connect to a Galaxy instance using `bioblend` and perform basic operations like listing histories and retrieving the Galaxy version. Ensure your Galaxy server is running and your API key is configured either directly in the script or via environment variables.

import os
from bioblend.galaxy import GalaxyInstance

# Replace with your Galaxy URL and API key or set as environment variables
GALAXY_URL = os.environ.get('GALAXY_URL', 'http://localhost:8080')
GALAXY_API_KEY = os.environ.get('GALAXY_API_KEY', 'YOUR_API_KEY_HERE')

if GALAXY_API_KEY == 'YOUR_API_KEY_HERE':
    print("Warning: Please replace 'YOUR_API_KEY_HERE' with your actual Galaxy API key or set the GALAXY_API_KEY environment variable.")
    exit(1)

try:
    # Connect to the Galaxy instance
    gi = GalaxyInstance(GALAXY_URL, key=GALAXY_API_KEY)

    # Example: Get a list of available histories
    histories = gi.histories.get_histories()
    print(f"Found {len(histories)} histories:")
    for hist in histories[:3]: # Print first 3 histories
        print(f"  - Name: {hist['name']}, ID: {hist['id']}")

    # Example: Get current Galaxy version
    version = gi.config.get_version()
    print(f"Galaxy Version: {version}")

except Exception as e:
    print(f"An error occurred: {e}")
    print("Please ensure your Galaxy server is running and accessible, and your API key is correct.")

view raw JSON →