Skip to content

Latest commit

 

History

History
51 lines (33 loc) · 2.46 KB

API.md

File metadata and controls

51 lines (33 loc) · 2.46 KB

API examples

The Next.js endpoints run with the main app. The Python endpoints require the optional backend. All analysis coordinates are 0-based, half-open.

Main app

  • GET /api/health: app status and version.
  • GET /api/encode?mark=H3K4me3&biosample=K562&assembly=GRCh38: up to 12 released ENCODE BigWig files.
  • /api/backend/{health,analyze,bigwig,geo}: bounded same-origin forwarding to the configured Python service.

ENCODE supports H3K4me3, H3K27ac, H3K27me3 and ATAC; assemblies are GRCh38 / mm10. Invalid queries return 400. An unavailable upstream returns 502. Search never accepts a user-supplied upstream URL.

Python interval analysis

curl -X POST http://127.0.0.1:8000/api/analyze \
  -H "Content-Type: application/json" \
  -d '{"chr":"chr1","start":5,"end":25,"format":"bedgraph","text":"chr1 0 10 2\nchr1 20 30 6"}'

Expected summary:

{ "count": 2, "covered": 10, "coverage": 0.5, "mean": 4.0, "max": 6.0 }

Limits: 8 MB of text, 50,000 intervals, 5 million bases per region. Invalid regions / text return 422; oversized requests return 413.

Python BigWig analysis

Install backend/requirements-bigwig.txt on a compatible system. POST the binary file body:

curl -X POST "http://127.0.0.1:8000/api/bigwig?chr=chr11&start=5220000&end=5240000&bins=200" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @signal.bw

Returns overlap-binned mean values and exact region mean, maximum and coverage. Missing bins are null. The maximum upload is 64 MB when calling the backend directly; the frontend proxy has a separate 9 MB request limit. Files are temporarily stored and deleted after processing. There is no arbitrary local path or remote URL access. If pyBigWig is unavailable, returns 501. Invalid binary / chromosome / region returns 422.

GEO study search

curl "http://127.0.0.1:8000/api/geo?q=H3K27ac%20K562"

Returns up to five GEO Series with accession, title, summary and source URL. Calls use fixed NCBI Entrez endpoints, are serialized with at least 0.4 seconds between starts, and are cached for five minutes. Query length is 2–120 characters; upstream failure returns 502.

Local service configuration

The Python service binds to loopback in the documented local command and has no permissive CORS policy. The UI uses same-origin API routes. There is no authentication system; configure one at the server boundary if sharing the service. Do not expose a development server as a public endpoint.