Universal data access patterns for downloading and parsing scientific data when ToolUniverse tools don't cover the source, only return metadata, or you need bulk records. Use for VCF/h5ad/BAM/SDF/GCT parsing, multi-step API workflows (search to filter to download to parse), thousands of records at once, or sources with no dedicated tool. Write Python code via Bash for every step.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
tooluniverse-data-wrangling
description
Universal data access patterns for downloading and parsing scientific data when ToolUniverse tools don't cover the source, only return metadata, or you need bulk records. Use for VCF/h5ad/BAM/SDF/GCT parsing, multi-step API workflows (search to filter to download to parse), thousands of records at once, or sources with no dedicated tool. Write Python code via Bash for every step.
Data Wrangling: Universal Access Patterns
Reference for downloading and parsing scientific data from any source. Write and run Python code via Bash for every step.
When to Use
ToolUniverse tool returned metadata/search results but you need raw or bulk data
Data is in a format tools don't parse (VCF, h5ad, BAM, SDF, GCT)
You need a multi-step API workflow (search -> filter -> download -> parse)
The data source has no ToolUniverse tool at all
You need thousands of records, not the 10-100 a tool returns
Decision: Tool vs Code
Situation
Use
Single record lookup, simple search, <100 results
ToolUniverse tool (execute_tool)
Bulk download, custom filtering, format conversion
import requests
base = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils"# Search -> get IDs -> fetch records in batches
ids = requests.get(f"{base}/esearch.fcgi?db=gene&term=BRCA1+AND+human&retmax=500&retmode=json").json()
id_list = ids["esearchresult"]["idlist"]
# Fetch in batches of 500for i inrange(0, len(id_list), 500):
batch = ",".join(id_list[i:i+500])
data = requests.get(f"{base}/efetch.fcgi?db=gene&id={batch}&retmode=xml").text
# Zenodo: search + download files
record = requests.get("https://zenodo.org/api/records", params={"q": "proteomics cancer", "size": 5}).json()["hits"]["hits"][0]
for f in record["files"]:
content = requests.get(f["links"]["self"]).content # download each file
These sources require registration or have no ToolUniverse tool. For each, the table shows access requirements and how to get data programmatically once credentialed.
Note: ToolUniverse has 2300+ tools — use find_tools("your topic") to discover tools not listed above. Section B covers the most common API patterns; many more databases use the same patterns (e.g., all EBI databases follow the EBI REST pattern in #2).
Source
Access
Wait Time
Format
Contents
UK Biobank
Restricted (institutional)
2-6 months
CSV/Bulk
500K participants, genetics + imaging + health records
dbGaP
Controlled (PI application)
1-3 months
SRA/VCF/phenotype
GWAS genotypes + phenotypes from thousands of studies
MIMIC-IV
Credentialed (PhysioNet)
1-2 weeks
CSV/Parquet
ICU clinical data, 300K+ admissions
ICPSR
Registration
1-3 days
Stata/CSV
Social/health science archives (10K+ studies)
HRS
Registration
1-3 days
Stata
Health & Retirement Study, 20K+ older Americans, biennial
ELSA
Registration
1-3 days
Stata/SPSS
English Longitudinal Study of Ageing
SHARE
Registration
1-2 weeks
Stata
Survey of Health, Ageing, Retirement in Europe (28 countries)
Materials Project
Free API key
Instant
JSON
150K+ computed materials properties
Human Cell Atlas
Open
Instant
h5ad/loom
Single-cell atlas across human tissues
ADNI
Application
1-2 months
DICOM/CSV
Alzheimer's neuroimaging + biomarkers + cognition
OpenNeuro
Open
Instant
NIfTI/BIDS
800+ neuroimaging datasets
CIBERSORTx
Free registration
Instant
GCT/TSV
Cell type deconvolution from bulk expression
FlowRepository
Open
Instant
FCS
Flow cytometry experiments
SynBioHub
Open
Instant
SBOL/GenBank
Synthetic biology parts and designs
For restricted sources: search literature (PubMed) for published analyses using that dataset. Papers cite their data source and often deposit derived data in public repositories (GEO, SRA, Zenodo).
import time
deffetch_with_retry(url, max_retries=3, **kwargs):
for attempt inrange(max_retries):
resp = requests.get(url, timeout=30, **kwargs)
if resp.status_code == 200: return resp
if resp.status_code == 429: # rate limited
wait = int(resp.headers.get("Retry-After", 2 ** attempt))
time.sleep(wait)
else:
time.sleep(2 ** attempt)
raise RuntimeError(f"Failed after {max_retries} retries: {url}")
Authentication
import os
# API key in header (most common)
headers = {"Authorization": f"Bearer {os.environ.get('API_KEY', '')}"}
# API key as query param
params = {"api_key": os.environ.get("API_KEY", "")}
# No auth needed for most scientific APIs (NCBI, EBI, PubChem, GDC, CDC)
Bulk Download with Streaming
defdownload_large_file(url, output_path):
with requests.get(url, stream=True, timeout=300) as r:
r.raise_for_status()
withopen(output_path, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
Error Handling
resp = requests.get(url, timeout=30)
if resp.status_code != 200:
raise ValueError(f"HTTP {resp.status_code}: {resp.text[:200]}")
# Guard against HTML error pages (CDC, NCBI return 200 with HTML for missing files)if resp.content[:5] in (b"<!DOC", b"<html"):
raise ValueError(f"Server returned HTML error page for {url}")
data = resp.json() # raises JSONDecodeError if not valid JSON