Generated banner for Unibind Database
Generated logo for Unibind Database

Unibind Database

Google DeepMindOfficialPublished by Google DeepMind

  • Skill
  • Tool integration
  • Science and research
  • Apache-2.0
  • Low risk
  • Has scripts

From the author

Queries the UniBind database for experimentally validated transcription factor (TF) binding sites. Use when retrieving direct TF-DNA interaction datasets, downloading binding site coordinates (BED/FASTA) for local analysis, or listing available datasets by species, cell line, or TF name. Don't use to query specific intervals, locations, genes, motif models or expression data.
— the description by Google DeepMind

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The UniBind database skill provides a structured interface to access direct TF-DNA interaction datasets. It enables researchers to list available species, cell lines, and transcription factors, as well as filter datasets based on specific biological conditions or sources. The skill includes functionality to download binding site coordinates in BED or FASTA formats for local analysis, while enforcing rate limits and providing tools for handling large query results efficiently.

What it does

  • Lists available species, cell lines, and transcription factors in the UniBind database.
  • Filters and retrieves specific TF-DNA interaction datasets using various metadata parameters.
  • Downloads binding site coordinates in BED or FASTA formats for downstream analysis.
  • Provides dataset details including experimental source and collection information.
  • Supports pagination and ordering for large result sets.
  • Integrates with command-line tools to process and filter JSON output.

When to use it

  • When you need to retrieve experimentally validated transcription factor binding site data.
  • When you require BED or FASTA files for local genomic analysis.
  • When you need to identify datasets associated with specific species, cell lines, or transcription factors.
  • When you need to programmatically access UniBind metadata for research workflows.

Advantages

  • Automated rate limiting ensures stable interaction with the UniBind API.
  • Supports efficient handling of large datasets through command-line piping and pagination.
  • Provides standardized access to validated TF-DNA interaction data.
  • Facilitates reproducible research by enabling direct download of specific binding site files.

Usage examples

“List all transcription factors available for Homo sapiens in the UniBind database.”
The agent executes the list_tfs command and filters the output to display only the relevant transcription factor names.
“Download the binding site data for CTCF in Homo sapiens from ENCODE as a BED file.”
The agent identifies the correct dataset identifier and uses the download_tfbs command to save the BED file to the specified directory.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/google-deepmind/unibind-database/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip unibind-database.zip -d .agents/skills

Documentation by Google DeepMind

UniBind Database Skill

UniBind is a database of direct TF–DNA interactions across 9 species, integrating ChIP-seq peaks with JASPAR TF binding profiles via the DAMO framework.

Prerequisites

  1. uv: Read the uv skill and follow its Setup instructions to ensure uv is installed and on PATH.

  2. User Notification: If .licenses/unibind_database_LICENSE.txt does not already exist in the workspace root directory then (1) prominently notify the user to check the terms at https://unibind.uio.no/ and https://unibind.uio.no/api/overview, then (2) create the file recording the notification text and timestamp.

Quick Start

Query commands print JSON to stdout by default. Most outputs are small enough to read directly. For large outputs (list_cell_lines, list_tfs), pipe through jq to extract only the fields you need.

uv run <SKILL DIR>/scripts/unibind_api.py list_species

The download_tfbs command writes BED/FASTA files to --output-dir instead. You may optionally use --output <path> on any query command to save results to a file if needed.

Core Rules

  • Use the Wrapper: ALWAYS execute the provided helper scripts to query the database rather than accessing the database directly. The scripts automatically enforce the required rate limit gracefully.

  • Output: Query commands print JSON to stdout. Most responses are compact and can be read directly.

  • Large Results: list_cell_lines and list_tfs produce large output. Pipe these through jq to extract specific fields rather than reading the full output into context.

  • Saving to File: Use --output <path> when you need to reference the data later or when processing very large results with jq.

  • Pagination: Use --page and --page-size (max 1000) to chunk large result sets.

  • Ordering: Use --order field_name (prefix with - for descending) on any list command.

  • Notification: If this skill is used, ensure this is mentioned in the output.

Utility Scripts

Replace <SKILL DIR> with the absolute path to this skill's directory.

1. List Species
uv run <SKILL DIR>/scripts/unibind_api.py list_species
2. List Collections
uv run <SKILL DIR>/scripts/unibind_api.py list_collections
3. List Cell Lines & TFs (large output — use jp)

These commands return large datasets. Use uvx --from jmespath jp to extract only the fields you need.

uv run <SKILL DIR>/scripts/unibind_api.py list_cell_lines | uvx --from jmespath jp "results[].name"
uv run <SKILL DIR>/scripts/unibind_api.py list_tfs | uvx --from jmespath jp "results[].tf_name"
4. List and Filter Datasets (and Profile-Specific Datasets)

Filter datasets using the following arguments:

  • --species (e.g., "Homo sapiens")

  • --tf-name (e.g., "CTCF")

  • --cell-line (e.g., "mESC")

  • --collection (e.g., Permissive, Robust)

  • --search (a search term)

  • --biological-condition (biological condition or source)

  • --data-source (source of data, e.g., "ENCODE")

  • --has-pvalue ("true" or "false")

  • --identifier (e.g., "GSE60130")

  • --jaspar-id (JASPAR database profile matrix ID)

  • --model (prediction model)

  • --summary (summary filter)

  • --threshold-pvalue (p-value threshold)

Use list_datasets for standard datasets, or list_specific_datasets for profile-specific queries.

uv run <SKILL DIR>/scripts/unibind_api.py list_datasets --species "Homo sapiens" --tf-name "CTCF" --data-source "ENCODE"
uv run <SKILL DIR>/scripts/unibind_api.py list_specific_datasets --species "Mus musculus" --cell-line "mESC"
5. Get Dataset Details
uv run <SKILL DIR>/scripts/unibind_api.py get_dataset "EXP047889.HMLE-Twist-ER_breast_cancer.SMAD3"
6. Download TFBS Files (BED / FASTA)

Downloads all TFBS files for a dataset to a local directory. Use --format bed (default) or --format fasta.

uv run <SKILL DIR>/scripts/unibind_api.py download_tfbs "EXP047889.HMLE-Twist-ER_breast_cancer.SMAD3" --output-dir /tmp/tfbs --format bed

Anti-Patterns

  • DON'T attempt to use the UniBind API to query specific genomic intervals, locations, or genes.

  • DON'T guess or hallucinate genome coordinates. Always use ensembl-database as an external check if you're pulling local BED tracks for offline bedtools intersection.

  • DON'T use for motif models (PFMs). Use the jaspar-database skill instead.

  • DON'T use for gene expression data. UniBind only stores binding events.

  • DON'T assume tissue-specific expression from dataset lists alone.

  • DON'T use cat to read large JSON output files into context. The output is too large. Use jq or write your own code to parse the output files.

Files

scripts/unibind_api.py

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""UniBind API skill wrapper."""

# /// script
# requires-python = ">=3.10"
# dependencies = [
#   "polite-http",
# ]
# ///

from __future__ import annotations

import argparse
import json
import os
import sys
from typing import Any
import urllib.parse

from polite_http import http_client

UNIBIND_API_PREFIX = "api/v1"
# This has to be the bare domain to support download links
CLIENT = http_client.HttpClient(f"https://unibind.uio.no/", qps=20.0)


def make_request(url: str) -> Any:
  """Makes an HTTP request to the UniBind API using HttpClient."""
  # Enforce output format as JSON if not specified in URL
  if "format=" not in url and ".json" not in url:
    separator = "&" if "?" in url else "?"
    url += f"{separator}format=json"

  return CLIENT.fetch_json(url, timeout=30)


def write_output(data: Any, output_file: str | None = None) -> None:
  """Writes data as JSON to a file or stdout.

  Args:
      data: The data to write.
      output_file: Optional path to an output JSON file. If None, prints to
        stdout.
  """
  if output_file:
    try:
      os.makedirs(os.path.dirname(os.path.abspath(output_file)), exist_ok=True)
      with open(output_file, "w", encoding="utf-8") as f:
        json.dump(data, f, indent=2)
      print(f"Output written to: {output_file}", file=sys.stderr)
    except (OSError, TypeError) as e:
      print(f"Error writing to file {output_file}: {e}", file=sys.stderr)
      sys.exit(1)
  else:
    print(json.dumps(data, indent=2))


def download_file(url: str, output_path: str) -> None:
  """Downloads a file from a URL to a local path using HttpClient."""
  data_bytes = CLIENT.fetch_bytes(url, timeout=60)
  with open(output_path, "wb") as f:
    f.write(data_bytes)
  print(f"Downloaded to {output_path} ({os.path.getsize(output_path)} bytes)")


def _build_list_url(
    endpoint: str,
    page: int | None = None,
    page_size: int | None = None,
    order: str | None = None,
    extra_params: dict[str, str] | None = None,
) -> str:
  """Builds a filtered and paginated URL for UniBind list endpoints.

  Args:
      endpoint: The API endpoint name (e.g., 'species').
      page: Optional page number.
      page_size: Optional number of items per page.
      order: Optional ordering string.
      extra_params: Optional dictionary of extra filter parameters.

  Returns:
      The fully constructed URL string.
  """
  params = {}
  if extra_params:
    params.update(extra_params)
  if page:
    params["page"] = page
  if page_size:
    params["page_size"] = page_size
  if order:
    params["order"] = order

  url = f"{UNIBIND_API_PREFIX}/{endpoint}/"
  query_string = urllib.parse.urlencode(params)
  if query_string:
    url += f"?{query_string}"
  return url


def list_species(args: argparse.Namespace) -> None:
  """Lists supported species.

  Args:
      args: Parsed command-line arguments.
  """
  url = _build_list_url(
      "species", page=args.page, page_size=args.page_size, order=args.order
  )
  data = make_request(url)
  write_output(data, getattr(args, "output", None))


def list_collections(args: argparse.Namespace) -> None:
  """Lists collections.

  Args:
      args: Parsed command-line arguments.
  """
  url = _build_list_url(
      "collections", page=args.page, page_size=args.page_size, order=args.order
  )
  data = make_request(url)
  write_output(data, getattr(args, "output", None))


def list_cell_lines(args: argparse.Namespace) -> None:
  """Lists cell lines.

  Args:
      args: Parsed command-line arguments.
  """
  url = _build_list_url(
      "celltypes", page=args.page, page_size=args.page_size, order=args.order
  )
  data = make_request(url)
  write_output(data, getattr(args, "output", None))


def list_tfs(args: argparse.Namespace) -> None:
  """Lists transcription factors.

  Args:
      args: Parsed command-line arguments.
  """
  url = _build_list_url(
      "tfs", page=args.page, page_size=args.page_size, order=args.order
  )
  data = make_request(url)
  write_output(data, getattr(args, "output", None))


def _build_dataset_filters(args: argparse.Namespace) -> dict[str, str]:
  """Extracts dataset filtering parameters from parsed arguments.

  Args:
      args: Parsed command-line arguments.

  Returns:
      A dictionary of filter parameters.
  """
  extra = {}
  filter_keys = [
      "species",
      "tf_name",
      "cell_line",
      "collection",
      "search",
      "biological_condition",
      "data_source",
      "has_pvalue",
      "identifier",
      "jaspar_id",
      "model",
      "summary",
      "threshold_pvalue",
  ]
  for key in filter_keys:
    val = getattr(args, key, None)
    if val is not None:
      extra[key] = str(val)
  return extra


def _print_dataset_list(
    endpoint: str,
    extra: dict[str, str],
    page: int | None,
    page_size: int | None,
    order: str | None,
    output_file: str | None = None,
) -> None:
  """Fetches and prints a paginated list of datasets.

  Args:
      endpoint: The API endpoint (e.g., 'datasets' or 'specific').
      extra: Dictionary of extra filtering parameters.
      page: Optional page number.
      page_size: Optional number of items per page.
      order: Optional ordering string.
      output_file: Optional path to write the output to. Prints to stdout if
        None.
  """
  url = _build_list_url(
      endpoint,
      page=page,
      page_size=page_size,
      order=order,
      extra_params=extra,
  )
  data = make_request(url)

  # Extract dataset_id from URL for convenience
  if "results" in data:
    for res in data["results"]:
      if "url" in res and "dataset_id" not in res:
        # URL format: https://unibind.uio.no/api/v1/{endpoint}/ID/
        res["dataset_id"] = res["url"].rstrip("/").split("/")[-1]

  write_output(data, output_file)


def list_datasets(args: argparse.Namespace) -> None:
  """Lists and filters datasets.

  Args:
      args: Parsed command-line arguments.
  """
  extra = _build_dataset_filters(args)
  _print_dataset_list(
      endpoint="datasets",
      extra=extra,
      page=args.page,
      page_size=args.page_size,
      order=args.order,
      output_file=getattr(args, "output", None),
  )


def list_specific_datasets(args: argparse.Namespace) -> None:
  """Lists and filters profile-specific datasets.

  Args:
      args: Parsed command-line arguments.
  """
  extra = _build_dataset_filters(args)
  _print_dataset_list(
      endpoint="specific",
      extra=extra,
      page=args.page,
      page_size=args.page_size,
      order=args.order,
      output_file=getattr(args, "output", None),
  )


def get_dataset(args: argparse.Namespace) -> None:
  """Retrieves details for a specific dataset.

  Args:
      args: Parsed command-line arguments.
  """
  url = f"{UNIBIND_API_PREFIX}/datasets/{args.dataset_id}/"
  data = make_request(url)
  write_output(data, getattr(args, "output", None))


def download_tfbs(args: argparse.Namespace) -> None:
  """Downloads TFBS BED or FASTA files for a dataset to a local directory.

  Args:
      args: Parsed command-line arguments.
  """
  dataset_id = args.dataset_id
  output_dir = args.output_dir
  file_format = args.file_format

  dataset = make_request(f"{UNIBIND_API_PREFIX}/datasets/{dataset_id}/")
  tfbs_list = dataset.get("tfbs", [])
  if not tfbs_list:
    print("No TFBS entries found for this dataset.", file=sys.stderr)
    sys.exit(1)

  url_key = f"{file_format}_url"
  os.makedirs(output_dir, exist_ok=True)
  downloaded = 0
  for model_group in tfbs_list:
    for model_name, entries in model_group.items():
      if not isinstance(entries, list):
        continue
      for entry in entries:
        url = entry.get(url_key)
        if not url:
          continue
        jaspar_id = entry.get("jaspar_id", "unknown")
        jaspar_ver = entry.get("jaspar_version", "0")
        ext = "bed" if file_format == "bed" else "fa"
        # Truncate names if necessary to stay short, but keep descriptive
        filename = f"{dataset_id}.{jaspar_id}.{jaspar_ver}.{model_name}.{ext}"
        filepath = os.path.join(output_dir, filename)
        download_file(url, filepath)
        downloaded += 1

  if downloaded == 0:
    print(f"No '{url_key}' URLs found in TFBS entries.", file=sys.stderr)
    sys.exit(1)
  print(
      f"\nDownloaded {downloaded} {file_format.upper()} file(s) to {output_dir}"
  )


def _add_pagination_args(parser: argparse.ArgumentParser) -> None:
  """Adds page, page-size, order, and optional output arguments to a parser.

  Args:
      parser: The argparse parser to add arguments to.
  """
  parser.add_argument(
      "--output",
      default=None,
      help="Output JSON file path (default: stdout).",
  )
  parser.add_argument("--page", type=int, help="Page number")
  parser.add_argument("--page-size", type=int, help="Page size (max 1000)")
  parser.add_argument(
      "--order", help="Order by field (prefix with - for descending)"
  )


def _add_dataset_filters(parser: argparse.ArgumentParser) -> None:
  """Adds dataset filtering arguments to a parser.

  Args:
      parser: The argparse parser to add arguments to.
  """
  parser.add_argument("--species", help="Filter by species")
  parser.add_argument("--tf-name", help="Filter by TF name")
  parser.add_argument("--cell-line", help="Filter by cell line")
  parser.add_argument(
      "--collection", help="Filter by collection (e.g., Permissive, Robust)"
  )

  parser.add_argument("--search", help="A search term")
  parser.add_argument(
      "--biological-condition", help="Biological condition or source"
  )
  parser.add_argument("--data-source", help="Source of the data (e.g., ENCODE)")
  parser.add_argument(
      "--has-pvalue",
      help="Select datasets meeting a p-value threshold (true/false)",
  )
  parser.add_argument("--identifier", help="Dataset identifier, e.g. GSE60130")
  parser.add_argument("--jaspar-id", help="JASPAR database profile matrix ID")
  parser.add_argument("--model", help="Prediction model")
  parser.add_argument("--summary", help="Obtain summary of TF and related data")
  parser.add_argument(
      "--threshold-pvalue", help="Threshold applying to p-value filtering"
  )
  _add_pagination_args(parser)


def main() -> None:
  """Parses command-line arguments and executes the selected command."""
  parser = argparse.ArgumentParser(description="UniBind API wrapper skill")
  subparsers = parser.add_subparsers(dest="command", required=True)

  # list_species
  p_sp = subparsers.add_parser("list_species", help="List supported species")
  _add_pagination_args(p_sp)
  p_sp.set_defaults(func=list_species)

  # list_collections
  p_col = subparsers.add_parser("list_collections", help="List collections")
  _add_pagination_args(p_col)
  p_col.set_defaults(func=list_collections)

  # list_cell_lines
  p_ct = subparsers.add_parser("list_cell_lines", help="List cell lines")
  _add_pagination_args(p_ct)
  p_ct.set_defaults(func=list_cell_lines)

  # list_tfs
  p_tf = subparsers.add_parser("list_tfs", help="List transcription factors")
  _add_pagination_args(p_tf)
  p_tf.set_defaults(func=list_tfs)

  # list_datasets
  p_list_ds = subparsers.add_parser(
      "list_datasets", help="List and filter datasets"
  )
  _add_dataset_filters(p_list_ds)
  p_list_ds.set_defaults(func=list_datasets)

  # list_specific_datasets
  p_list_spec = subparsers.add_parser(
      "list_specific_datasets", help="List and filter profile-specific datasets"
  )
  _add_dataset_filters(p_list_spec)
  p_list_spec.set_defaults(func=list_specific_datasets)

  # get_dataset
  p_get_ds = subparsers.add_parser("get_dataset", help="Get dataset details")
  p_get_ds.add_argument(
      "dataset_id", help="Dataset ID (e.g., EXP030726.neural_stem_cells.SMAD3)"
  )
  p_get_ds.add_argument(
      "--output",
      default=None,
      help="Output JSON file path (default: stdout).",
  )
  p_get_ds.set_defaults(func=get_dataset)

  # download_tfbs
  p_dl = subparsers.add_parser(
      "download_tfbs", help="Download TFBS BED/FASTA files for a dataset"
  )
  p_dl.add_argument("dataset_id", help="Dataset ID")
  p_dl.add_argument(
      "--output-dir", required=True, help="Directory to save downloaded files"
  )
  p_dl.add_argument(
      "--format",
      dest="file_format",
      choices=["bed", "fasta"],
      default="bed",
      help="File format to download (default: bed)",
  )
  p_dl.set_defaults(func=download_tfbs)

  args = parser.parse_args()
  if hasattr(args, "func"):
    args.func(args)
  else:
    parser.print_help()


if __name__ == "__main__":
  main()

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google DeepMind
Publisher
Google DeepMind (Official)
Source
google-deepmind/science-skills · skills/unibind_database · commit 4de6786
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google DeepMind or Google DeepMind.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download unibind-database.zip