The Polymer Genomics API serves curated genomic annotations at base-pair resolution. All endpoints return JSON with 1-based closed coordinates by default.
https://api.polymerbio.org/v1/regions/{build}/{region}The primary endpoint. Returns all annotation layers for a genomic region. Layers are returned as GRanges objects with metadata columns.
buildstring*Genome build: hg38 or hg37regionstring*Genomic region, e.g. chr17:7668421-7687490layersstringComma-separated layer keys to includecoordsstring = 1basedCoordinate system: 1based or 0basedlimitintegerMax features per layer/v1/genes/{build}/{symbol}Look up a gene by symbol. Returns transcript features as GRanges with exon, UTR, and CDS annotations.
buildstring*Genome buildsymbolstring*Gene symbol, e.g. TP53, BRCA1/v1/sequence/{build}/{region}Retrieve the raw DNA sequence for a genomic region. Returns an uppercase nucleotide string.
buildstring*Genome buildregionstring*Genomic regioncoordsstring = 1basedCoordinate system/v1/probes/{build}/{probe_id}Look up a single methylation array probe by ID. Returns coordinates, CpG context, and cross-mapping information.
buildstring*Genome buildprobe_idstring*Probe identifier, e.g. cg00000029/v1/probes/{build}/batchLook up multiple probes in a single request. Accepts a JSON body with an array of probe IDs.
buildstring*Genome buildprobe_idsstring[]*Array of probe identifiers/v1/searchSearch for gene symbols by prefix. Returns matching gene names for autocomplete.
qstring*Search query (min 2 characters)buildstring*Genome build/v1/layersList all available annotation layers. Returns metadata including row counts and versioning.
typestringFilter by layer typebuildstringFilter by genome buildactiveboolean = trueOnly show active layers/v1/aggregation/{build}/{region}Get binned density and summary statistics for a region. Useful for visualizing large regions where individual features are too dense.
buildstring*Genome buildregionstring*Genomic regionlayersstringLayer keys to aggregateresolutioninteger = 1000Bin size in base pairsAll errors return a JSON object with a top-level error key containing code and message fields.
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description."
}
}MISSING_API_KEYRequest did not include an API key. Pass your key via the X-API-Key header or api_key query parameter.
{
"error": {
"code": "MISSING_API_KEY",
"message": "API key is required. Pass via X-API-Key header."
}
}INVALID_API_KEYThe provided API key is not valid or has been revoked.
{
"error": {
"code": "INVALID_API_KEY",
"message": "The API key provided is not valid."
}
}NOT_FOUNDThe requested resource does not exist. Check the path, genome build, gene symbol, or probe ID.
{
"error": {
"code": "NOT_FOUND",
"message": "Gene 'FAKEGENE' not found in hg38."
}
}VALIDATION_ERRORThe request parameters failed validation. The message field describes which parameter is invalid and why.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid region format. Expected chr1:100-200."
}
}RATE_LIMITEDToo many requests. Back off and retry after the duration indicated in the Retry-After header.
{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Retry after 60 seconds."
}
}INTERNAL_ERRORAn unexpected server error occurred. If this persists, contact support with the request details.
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred."
}
}The Polymer Genomics MCP server exposes 70 tools for AI agent consumption via the Model Context Protocol.60 reference tools query polymerbio.org over HTTP.10 compute tools run local R/Bioconductor analysis via subprocess.
Claude Code
│
polymer-genomics MCP server (local)
├─ Reference tools (60) → HTTP → api.polymerbio.org
├─ Compute tools (10) → Rscript subprocess
└─ Session state → /tmp/polymer/sessions/uvx polymer-genomics-mcp{
"mcpServers": {
"polymer-genomics": {
"command": "uvx",
"args": ["polymer-genomics-mcp"]
}
}
}load_idats → normalize → filter_probes → run_limma
│
volcano_plot / cluster_probes
│
batch_probes → lookup_gene_expression
(annotate hits with reference tools)Compute tools require local R with Bioconductor packages. Reference tools work without R.
Rscript -e "install.packages('BiocManager')
BiocManager::install(c('minfi','sesame','limma','matrixStats',
'maxprobes','ComplexHeatmap','circlize'))
install.packages(c('jsonlite','ggplot2','svglite','base64enc'))"Or use Docker: docker run polymerbio/methylation-toolkit
load_idatsLoad Illumina IDAT files and create an analysis session. Auto-detects array type (450K, EPIC, EPICv2) and runs initial QC.
idat_directorystring*Path to directory containing .idat filessample_sheetstringPath to SampleSheet.csv (auto-detected if omitted)normalizeNormalize methylation data. Supports openSesame (EPICv2), funnorm (450K/EPIC), quantile, noob, and raw.
session_idstring*Session ID from load_idatsmethodstring = funnormNormalization methodfilter_probesFilter probes by QC criteria: detection p-value failures, SNP loci, sex chromosomes, and cross-reactive probes.
session_idstring*Session ID from load_idatsremove_snpboolean = trueRemove probes at known SNP positionsremove_sexboolean = trueRemove sex chromosome probesremove_crossreactiveboolean = trueRemove cross-reactive probesrun_limmaDifferential methylation analysis with limma eBayes on M-values. Returns top DMPs with delta-beta and adjusted p-values.
session_idstring*Session ID from load_idatsgroup_columnstring*Column name in sample sheet defining groupscontraststringExplicit contrast (e.g. "TET2_mut-WT"). Auto-detected for 2 groupscovariatesstring[]Covariate column names (e.g. ["Age", "Sex"])fdrnumber = 0.05FDR thresholdget_betasExtract beta values (methylation levels 0–1). Returns inline for ≤100 probes, writes CSV for larger requests.
session_idstring*Session ID from load_idatsprobesstring[]Probe IDs to extract (all if omitted)get_m_valuesExtract M-values (log2 ratio, used for statistics). Returns inline for ≤100 probes, writes CSV for larger requests.
session_idstring*Session ID from load_idatsprobesstring[]Probe IDs to extract (all if omitted)volcano_plotGenerate a volcano plot from differential methylation results. Returns base64-encoded PNG for inline display.
session_idstring*Session ID from load_idatsfdrnumber = 0.05FDR threshold for significance linedeltabetanumber = 0.1Delta-beta threshold for effect size linescluster_probesHierarchical clustering heatmap of the most variable probes. Returns base64-encoded PNG and cluster assignments.
session_idstring*Session ID from load_idatsn_probesinteger = 1000Number of top variable probes to includedistancestring = euclideanDistance metricsession_statusCheck which pipeline steps have been completed, list generated files, and report creation time.
session_idstring*Session ID from load_idatscleanup_session_toolRemove an analysis session and all its data. Deletes checkpoints, results, and plots permanently.
session_idstring*Session ID to removecurl "https://api.polymerbio.org/v1/regions/hg38/chr17:7668421-7687490?layers=gencode_v44,cpg_sites"
{
"status": "complete",
"coordinate_system": "1-based_closed",
"query": {
"build": "hg38",
"chr": "chr17",
"start": 7668421,
"end": 7687490curl "https://api.polymerbio.org/v1/genes/hg38/TP53"
{
"status": "complete",
"data": {
"class": "GRanges",
"seqnames": ["chr17", "chr17", ...],
"ranges": {
"start": [7668421, 7669609, ...],
"end": [7687490, 7669690, ...],curl "https://api.polymerbio.org/v1/sequence/hg38/chr17:7676000-7676100"
{
"status": "complete",
"data": {
"sequence": "ATCGATCG...",
"length": 101,
"chr": "chr17",
"start": 7676000,
"end": 7676100curl "https://api.polymerbio.org/v1/probes/hg38/cg00000029"
{
"status": "complete",
"data": {
"probe_id": "cg00000029",
"chr": "chr16",
"start": 53434200,
"end": 53434201,
"cpg_context": "open_sea",curl -X POST "https://api.polymerbio.org/v1/probes/hg38/batch" \
-H "Content-Type: application/json" \
-d '{"probe_ids": ["cg00000029", "cg00000108"]}'{
"status": "complete",
"data": {
"cg00000029": { "chr": "chr16", ... },
"cg00000108": { "chr": "chr4", ... }
}
}curl "https://api.polymerbio.org/v1/search?q=BRC&build=hg38"
{
"results": [
{ "gene_symbol": "BRCA1" },
{ "gene_symbol": "BRCA2" },
{ "gene_symbol": "BRCC3" }
]
}curl "https://api.polymerbio.org/v1/layers?build=hg38"
[
{
"layer_key": "gencode_v44",
"name": "GENCODE v44",
"type": "gene_model",
"build": "hg38",
"row_count": 2800000,
"active": truecurl "https://api.polymerbio.org/v1/aggregation/hg38/chr17:7000000-8000000?layers=cpg_sites&resolution=10000"
{
"data": {
"cpg_sites": {
"bins": [
{ "bin_start": 7000000, "bin_end": 7010000, "count": 42, "density": 0.0042 },
...
],
"resolution": 10000,# In Claude Code, the agent calls tools conversationally: > "Load my IDATs from ~/data/idats" load_idats(idat_directory="~/data/idats") → {session_id: "a1b2c3d4e5f6", n_samples: 18, array_type: "EPICv2", n_probes: 1107072} > "Normalize with openSesame and filter" normalize(session_id="a1b2c3d4e5f6", method="opensesame") → {n_probes: 935620, method: "opensesame"} filter_probes(session_id="a1b2c3d4e5f6") → {n_before: 935620, n_after: 795423, removed_counts: {snp: 42891, sex: 18234, ...}} > "Find DMPs between TET2_mut and WT" run_limma(session_id="a1b2c3d4e5f6", group_column="Sample_Group") → {n_dmps: 0, contrast: "TET2_mut-WT", n_tested: 795423, top_hits: [...]} > "Make a volcano plot" volcano_plot(session_id="a1b2c3d4e5f6") → {image_base64: "iVBOR...", n_significant: 0} # Then annotate hits with reference tools: batch_probes(build="hg38", probe_ids=["cg08796240", "cg06545761"]) → gene symbols, coordinates, CpG context lookup_gene_expression(build="hg38", symbol="VAC14") → GTEx 54-tissue expression profile
load_idats → [raw.rds]
│
normalize → [normalized.rds]
│
filter_probes → [filtered.rds]
│
run_limma → [dmps.rds, dmps.csv]
│
volcano_plot / cluster_probes
→ [volcano.svg, heatmap.svg]All REST API endpoints above are also available as MCP tools with the same parameters. The MCP server wraps each endpoint so agents can call them without constructing HTTP requests.