ucsc-genome-browser
Query UCSC Genome Browser REST API for DNA sequences, tracks, gene models, and conservation across 100+ assemblies. Retrieve sequence by region, list/fetch BED/bigWig tracks, chromosome sizes, RefSeq/GENCODE gene structures, PhyloP/PhastCons scores.
Install / Use
npx skills add jaechang-hits/SciAgent-Skills --skill ucsc-genome-browserInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of ucsc-genome-browser
ucsc-genome-browser scores 91/100 on our quality scale, 1178th of 4,716 Development & Engineering skills we index (top 25%).
Its SKILL.md is 23 KB long, well organised into 56 sections with 20 code examples: a thorough specification that gives an agent plenty to work with.
It has 367 GitHub stars, a meaningful sign that others use it.
Maintenance, license and trust
- The repository was last updated about 3 months ago, so ucsc-genome-browser is actively maintained.
- Our last check on 2026-11-20 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-10-05. Automated pattern scan on 2026-10-05. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
ucsc-genome-browser compared with similar skills
All 4 of these similar skills score higher than ucsc-genome-browser; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| ucsc-genome-browser (this skill)by jaechang-hits | 91 | 367 | 3mo ago | SKILL.md |
| taste-skillby Leonxlnx | 100 | 118.9k | 11d ago | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 113.3k | 12d ago | CLAUDE.md |
| hyperframesby heygen-com | 100 | 87.1k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 80.2k | today | CLAUDE.md |
Frequently asked questions
- How do I install ucsc-genome-browser?
- Run
npx skills add jaechang-hits/SciAgent-Skills --skill ucsc-genome-browser. The install tabs above show the steps for each supported agent. - Which AI agents does ucsc-genome-browser work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is ucsc-genome-browser safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is ucsc-genome-browser still maintained?
- The repository was last updated about 3 months ago, so ucsc-genome-browser is actively maintained.
Skill content
View source on GitHubname: "ucsc-genome-browser" description: "Query UCSC Genome Browser REST API for DNA sequences, tracks, gene models, and conservation across 100+ assemblies. Retrieve sequence by region, list/fetch BED/bigWig tracks, chromosome sizes, RefSeq/GENCODE gene structures, PhyloP/PhastCons scores. Use for UCSC annotations; Ensembl REST API for Ensembl gene IDs and VEP variant annotation." license: "Apache-2.0"
UCSC Genome Browser
Overview
The UCSC Genome Browser REST API at https://api.genome.ucsc.edu/ provides programmatic access to genome sequences, annotation tracks, and hub data for 100+ assemblies including hg38, mm39, and dm6. The API is free, requires no authentication, and returns JSON. Use it with the requests library to fetch DNA sequences for genomic regions, retrieve track data (genes, repeats, conservation), list available tracks, and query chromosome sizes for genome-scale coordinate arithmetic.
When to Use
- Fetching the reference DNA sequence for any genomic region (e.g., promoter, exon, CRISPR target) across human, mouse, or other assemblies
- Retrieving RefSeq or GENCODE gene structure (exon coordinates, CDS boundaries, strand) for a locus of interest
- Looking up PhyloP or PhastCons conservation scores to assess evolutionary constraint at a variant site
- Listing and querying any of UCSC's 1000+ annotation tracks (repeats, regulatory elements, conservation) for a region
- Getting chromosome sizes for a genome assembly to set up bedtools, pysam, or coverage pipelines
- Accessing public UCSC track hubs (e.g., ENCODE, Roadmap Epigenomics) without downloading data locally
- Use
ensembl-databaseinstead when you need Ensembl stable IDs, VEP variant annotation, or cross-species comparative genomics via the Ensembl REST API - For bulk local queries across millions of regions, use
bedtools-genomic-intervalswith pre-downloaded UCSC annotation files
Prerequisites
- Python packages:
requests,matplotlib(for visualization) - Data requirements: genomic coordinates (chrom, start, end in 0-based half-open BED format), genome assembly name (e.g.,
hg38,mm39) - Environment: internet connection; no authentication required
- Rate limits: no official published limit; add 0.5s delays for batch requests (>100 queries)
pip install requests matplotlib
Quick Start
import requests
BASE = "https://api.genome.ucsc.edu"
def get_sequence(genome, chrom, start, end):
"""Fetch DNA sequence for a genomic region (0-based, half-open)."""
r = requests.get(f"{BASE}/getData/sequence",
params={"genome": genome, "chrom": chrom,
"start": start, "end": end})
r.raise_for_status()
return r.json()["dna"]
# Fetch 1 kb around the BRCA1 TSS on hg38
seq = get_sequence("hg38", "chr17", 43044294, 43045294)
print(f"Length: {len(seq)} bp")
print(f"Sequence: {seq[:60]}...")
# Length: 1000 bp
# Sequence: ATGATTGGTGGTTACATGCACAGTTGCTCTGGGAAGTTTCTTCTTCAGTTGAGAAAAGGT...
Core API
Query 1: Sequence Retrieval
Fetch the reference DNA sequence for any genomic region using the getData/sequence endpoint. Coordinates are 0-based, half-open (BED format).
import requests
BASE = "https://api.genome.ucsc.edu"
def get_sequence(genome, chrom, start, end):
"""Return DNA sequence string for the given region."""
r = requests.get(f"{BASE}/getData/sequence",
params={"genome": genome, "chrom": chrom,
"start": start, "end": end})
r.raise_for_status()
data = r.json()
return data["dna"]
# TP53 exon 4 region (hg38)
seq = get_sequence("hg38", "chr17", 7676520, 7676620)
print(f"Region: chr17:7,676,520-7,676,620 ({len(seq)} bp)")
print(f"Sequence: {seq}")
# Reverse-complement for minus-strand genes
def revcomp(seq):
comp = str.maketrans("ACGTacgt", "TGCAtgca")
return seq.translate(comp)[::-1]
# BRCA2 on minus strand (hg38)
seq_fwd = get_sequence("hg38", "chr13", 32315086, 32315186)
seq_rc = revcomp(seq_fwd)
print(f"Forward: {seq_fwd[:30]}...")
print(f"RevComp: {seq_rc[:30]}...")
Query 2: Track Data Query
Retrieve annotation data (BED records) from any UCSC track for a genomic region.
import requests
BASE = "https://api.genome.ucsc.edu"
def get_track_data(genome, track, chrom, start, end):
"""Fetch annotation records from a UCSC track for a region."""
r = requests.get(f"{BASE}/getData/track",
params={"genome": genome, "track": track,
"chrom": chrom, "start": start, "end": end})
r.raise_for_status()
data = r.json()
# Track data is under the key matching the track name
return data.get(track, data.get("data", []))
# Fetch RepeatMasker annotations in the MYC locus (hg38)
repeats = get_track_data("hg38", "rmsk", "chr8", 127_735_434, 127_742_951)
print(f"Repeat elements in MYC locus: {len(repeats)}")
for r in repeats[:3]:
print(f" {r.get('repName', r.get('name'))} | {r['chromStart']}-{r['chromEnd']}")
# Fetch CpG islands near a promoter
cpg_islands = get_track_data("hg38", "cpgIslandExt", "chr17", 43_044_000, 43_050_000)
print(f"CpG islands found: {len(cpg_islands)}")
for island in cpg_islands:
print(f" {island['name']}: {island['chromStart']}-{island['chromEnd']}, "
f"obsExp={island.get('obsExp', 'n/a')}")
Query 3: Track List
List all available annotation tracks for a genome assembly to discover what data is available.
import requests
BASE = "https://api.genome.ucsc.edu"
def list_tracks(genome):
"""Return a dict of {track_name: track_metadata} for a genome assembly."""
r = requests.get(f"{BASE}/list/tracks", params={"genome": genome})
r.raise_for_status()
return r.json().get("tracks", {})
tracks = list_tracks("hg38")
print(f"Total tracks in hg38: {len(tracks)}")
# Find conservation-related tracks
conserv = {k: v for k, v in tracks.items() if "conserv" in k.lower() or "phylop" in k.lower()}
for name, meta in list(conserv.items())[:5]:
print(f" {name}: {meta.get('shortLabel', '')}")
Query 4: Chromosome Sizes
Get the length of every chromosome (or scaffold) for a genome assembly.
import requests
BASE = "https://api.genome.ucsc.edu"
def get_chrom_sizes(genome):
"""Return {chrom: size_in_bp} for a genome assembly."""
r = requests.get(f"{BASE}/list/chromosomes", params={"genome": genome})
r.raise_for_status()
return r.json().get("chromosomeSizes", {})
sizes = get_chrom_sizes("hg38")
print(f"hg38 chromosome count: {len(sizes)}")
# Show canonical autosomes + sex chromosomes
canonical = {c: sizes[c] for c in sorted(sizes) if c in
[f"chr{i}" for i in range(1, 23)] + ["chrX", "chrY", "chrM"]}
for chrom, length in sorted(canonical.items(),
key=lambda x: int(x[0].replace("chr", "").replace("X", "23").replace("Y", "24").replace("M", "25"))):
print(f" {chrom}: {length:,} bp")
Query 5: Gene Annotation
Query RefSeq gene models (exon coordinates, CDS, strand) for a genomic region.
import requests
BASE = "https://api.genome.ucsc.edu"
def get_refgene(genome, chrom, start, end):
"""Retrieve RefSeq gene annotations for a region."""
r = requests.get(f"{BASE}/getData/track",
params={"genome": genome, "track": "refGene",
"chrom": chrom, "start": start, "end": end})
r.raise_for_status()
return r.json().get("refGene", [])
# Query EGFR gene region (hg38)
genes = get_refgene("hg38", "chr7", 55_019_017, 55_211_628)
for g in genes:
exon_count = g.get("exonCount", 0)
print(f" {g['name2']} ({g['name']}) | {g['strand']} | "
f"tx: {g['txStart']}-{g['txEnd']} | exons: {exon_count}")
# Parse exon intervals from a refGene record
def parse_exons(gene_record):
"""Return list of (exon_start, exon_end) from a refGene record."""
starts = [int(s) for s in gene_record["exonStarts"].strip(",").split(",") if s]
ends = [int(e) for e in gene_record["exonEnds"].strip(",").split(",") if e]
return list(zip(starts, ends))
genes = get_refgene("hg38", "chr7", 55_019_017, 55_211_628)
if genes:
g = genes[0]
exons = parse_exons(g)
print(f"{g['name2']}: {len(exons)} exons")
for i, (s, e) in enumerate(exons[:4], 1):
print(f" Exon {i}: {s}-{e} ({e-s} bp)")
Query 6: Conservation Scores
Fetch per-base PhyloP or PhastCons conservation scores for a genomic region.
import requests
BASE = "https://api.genome.ucsc.edu"
def get_conservation(genome, track, chrom, start, end):
"""Retrieve per-base conservation scores from a bigWig track."""
r = requests.get(f"{BASE}/getData/track",
params={"genome": genome, "track": track,
"chrom": chrom, "start": start, "end": end})
r.raise_for_status()
data = r.json()
# bigWig tracks return a list of {start, end, value} intervals
return data.get(track, [])
# PhyloP 100-way conservation at TP53 mutation hotspot (hg38)
# chr17:7,676,594 = codon 248 (R248W/Q common hotspot)
scores = get_conservation("hg38", "phyloP100way", "chr17", 7_676_580, 7_676_610)
print(f"PhyloP 100way scores ({len(scores)} intervals):")
for s in scores[:5]:
print(f" chr17:{s['start']}-{s['end']}: phyloP = {s['value']:.3f}")
# Positive scores = conserved; negative = fast-evolving
Query 7: Hub Access
Access public UCSC track hubs and list their available assemblies and tracks.
import requests
BASE = "https://api.genome.ucsc.edu"
def list_ucsc_genomes():
"""Return all UCSC-hosted genome assemblies."""
r = requests.get(f"{BASE}/list/ucscGenomes")
r.raise_for_status()
return r.json().get("ucscGenomes", {})
genomes = list_ucsc_genomes()
print(f"Total UCSC genome assemblies: {len(genomes)}")
# Find all human assemblies
human = {k: v for k, v in genomes.items() if "Homo sapiens" in v.get("scientificName", "")}
for name, meta in sorted(human.items()):
print(f" {name}: {meta.get('description', '')}")
Key Concepts
0-Based vs. 1-Based Coordinates
The UCSC REST API uses 0-based, half-open intervals (BED format): start is inclusive, end is exclusive. This matches BED files and Python slicing. The UCSC Genome Browser web interface displays 1-based positions. To convert: API start = browser_start - 1, API end = browser_end.
# Browser position: chr17:7,676,521-7,676,620 (1-based, closed)
# API query (0-based, half-open):
start_api = 7_676_520 # browser_start - 1
end_api = 7_676_620 # browser_end unchanged
seq = get_sequence("hg38", "chr17", start_api, end_api)
print(f"Fetched {len(seq)} bp (expected 100)")
Track Data Response Format
Track data returned from /getData/track is keyed by track name. BED-like tracks return a list of dicts with chrom, chromStart, chromEnd, name, score, strand. bigWig tracks (conservation, signal) return {start, end, value} intervals. Always check the actual key in the response JSON, which matches the track parameter name.
Common Workflows
Workflow 1: Extract Promoter Sequences for a Gene List
Goal: Retrieve 2 kb upstream of the TSS for each gene in a list, for motif analysis or primer design.
import requests
import time
BASE = "https://api.genome.ucsc.edu"
GENOME = "hg38"
PROMOTER_UP = 2000 # bp upstream of TSS
def get_refgene(genome, chrom, start, end):
r = requests.get(f"{BASE}/getData/track",
params={"genome": genome, "track": "refGene",
"chrom": chrom, "start": start, "end": end})
r.raise_for_status()
return r.json().get("refGene", [])
def get_sequence(genome, chrom, start, end):
r = requests.get(f"{BASE}/getData/sequence",
params={"genome": genome, "chrom": chrom
Truncated for display — read the full file on GitHub.
Related Skills
taste-skill
118.9kAgent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
Agent-Reach
113.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
hyperframes
87.1kAI video you can actually edit. HyperFrames is a free, open-source AI video editor. Describe any video and get a real project you can change down to the frame.
headroom
80.2kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
