API Reference

Build BSgenome packages programmatically. Free, no authentication required.

Base URL: https://api.autobsgenome.org

POST/api/build

Trigger a new BSgenome package build.

Request Body

{
  "package_name": "BSgenome.Hsapiens.NCBI.GRCh38",
  "organism": "Homo sapiens",
  "common_name": "Human",        // optional
  "genome": "GRCh38",            // optional
  "provider": "NCBI",            // optional
  "version": "1.0.0",            // optional, default "1.0.0"
  "circ_seqs": "MT",             // optional, or "character(0)"
  "accession": "GCF_000001405.40",
  "data_source": "ncbi"          // "ncbi" or "ensembl"
}

Response

{
  "job_id": "4c1e14f7",
  "status": "queued",
  "queue_position": 0
}
GET/api/status/:jobId

Check build status. Poll every 5–10 seconds.

Response (building)

{ "job_id": "4c1e14f7", "status": "building" }

Response (complete)

{
  "job_id": "4c1e14f7",
  "status": "complete",
  "package_name": "BSgenome.Hsapiens.NCBI.GRCh38 1.0.0",
  "download_url": "https://github.com/.../BSgenome...tar.gz",
  "file_name": "BSgenome.Hsapiens.NCBI.GRCh38_1.0.0.tar.gz",
  "file_size": 782000000
}
GET/api/queue

Check current build queue status.

Response

{
  "running": 2,
  "queued": 1,
  "total": 3,
  "runs": [
    { "id": 123, "status": "running", "name": "Build BSgenome.Xxx (...)" }
  ]
}

Examples

curl (bash)

# 1. Trigger build
JOB=$(curl -s -X POST https://api.autobsgenome.org/api/build \
  -H "Content-Type: application/json" \
  -d '{"package_name":"BSgenome.Scerevisiae.NCBI.R64","organism":"Saccharomyces cerevisiae","accession":"GCF_000146045.2","data_source":"ncbi","circ_seqs":"MT"}')
JOB_ID=$(echo $JOB | python3 -c "import json,sys;print(json.load(sys.stdin)['job_id'])")

# 2. Poll for completion
while true; do
  STATUS=$(curl -s "https://api.autobsgenome.org/api/status/$JOB_ID")
  echo $STATUS | python3 -c "import json,sys;print(json.load(sys.stdin)['status'])"
  echo $STATUS | python3 -c "import json,sys;d=json.load(sys.stdin);exit(0 if d['status'] in ('complete','failed') else 1)" && break
  sleep 10
done

# 3. Install in R
URL=$(echo $STATUS | python3 -c "import json,sys;print(json.load(sys.stdin)['download_url'])")
Rscript -e "install.packages('$URL', repos=NULL, type='source')"

R

# Install from community repository (if already built)
install.packages("BSgenome.Scerevisiae.NCBI.R64",
  repos = "https://johnnychen1113.github.io/autoBSgenome")

# Or install from direct URL
install.packages(
  "https://github.com/.../BSgenome.Scerevisiae.NCBI.R64_1.0.0.tar.gz",
  repos = NULL, type = "source")

Rate Limits & Notes

  • No authentication required
  • Builds are queued and processed sequentially (~45s for small genomes, ~5min for large)
  • Packages are permanently published to the community repository
  • CORS enabled for browser requests from any origin