07. API Usage

Overview

The CoMMpass Analysis project provides pre-computed analysis results as static JSON files hosted on GitHub Pages. These endpoints are updated on each pipeline run and serve read-only data derived from the GDC portal.

Base URL: https://JohnGavin.github.io/coMMpass-analysis/api/v1/

Data is pre-computed via a targets pipeline and serialized to JSON. For raw (non-derived) data, visit the original data sources listed in the Raw Data Sources section below.

Available Endpoints

The table below lists all JSON API endpoints with their descriptions and record counts.

Example: curl

Fetch endpoint data from the command line using curl and jq.

Show code
safe_tar_read("code_api_curl")

Fetch the endpoint index

curl -s https://JohnGavin.github.io/coMMpass-analysis/api/v1/index.json | jq .

Fetch clinical data

curl -s https://JohnGavin.github.io/coMMpass-analysis/api/v1/clinical.json | jq ‘.metadata’

Download survival data

curl -o survival.json https://JohnGavin.github.io/coMMpass-analysis/api/v1/survival.json

Example: R (jsonlite)

Load API data directly into R data frames using jsonlite::fromJSON().

Show code
safe_tar_read("code_api_r")

base_url <- “https://JohnGavin.github.io/coMMpass-analysis/api/v1”

Read endpoint index

index <- jsonlite::fromJSON(paste0(base_url, “/index.json”)) index$endpoints

Load clinical data as data frame

clinical <- jsonlite::fromJSON(paste0(base_url, “/clinical.json”)) str(clinicalmetadata)head(clinicaldata)

Load survival data

surv <- jsonlite::fromJSON(paste0(base_url, “/survival.json”)) dim(surv$data)

Example: Python (requests)

Access the API from Python using requests and pandas.

Show code
safe_tar_read("code_api_python")

import requests import pandas as pd

base_url = “https://JohnGavin.github.io/coMMpass-analysis/api/v1”

Fetch clinical data

resp = requests.get(f”{base_url}/clinical.json”) data = resp.json() print(f”Rows: {data[‘metadata’][‘n_rows’]}“)

Convert to DataFrame

df = pd.DataFrame(data[‘data’]) print(df.head())

Raw Data Sources

This pipeline uses open-access GDC data only. For non-derived data:

Additional data (FISH, PFS, treatment response) would require MMRF Researcher Gateway access (https://research.themmrf.org/), which is not currently available to this project.

Phase 2 Roadmap

A future release will provide a dynamic plumber API with query parameters for filtering, subsetting, and custom analyses. The plumber endpoint functions already exist in R/10_api.R and inst/plumber/plumber.R. Phase 2 will add authentication, rate limiting, and OpenAPI documentation.

Data Sources

Results in this vignette are derived from the MMRF CoMMpass study (MMRF-COMMPASS, ~1,143 patients), downloaded via TCGAbiolinks. The pipeline runs with a configurable sample_limit (default 200; CI uses 20).

For full citations, data access tiers, and the distinction between pipeline data and synthetic test data, see the Data Sources vignette.

Recent Changes

Recent project commits with lines added, files changed, and change categories.

Reproducibility

Session Info (click to expand)
Show code
sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] targets_1.12.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.7.3       cli_3.6.6         knitr_1.51        rlang_1.3.0      
#>  [5] xfun_0.60         otel_0.2.0        processx_3.9.0    jsonlite_2.0.0   
#>  [9] data.table_1.18.4 glue_1.8.1        prettyunits_1.2.0 DT_0.34.0        
#> [13] buildtools_1.0.0  backports_1.5.1   htmltools_0.5.9   maketools_1.3.2  
#> [17] sys_3.4.3         ps_1.9.3          sass_0.4.10       rmarkdown_2.31   
#> [21] jquerylib_0.1.4   crosstalk_1.2.2   tibble_3.3.1      evaluate_1.0.5   
#> [25] base64url_1.4     fastmap_1.2.0     yaml_2.3.12       lifecycle_1.0.5  
#> [29] compiler_4.6.1    codetools_0.2-20  igraph_2.3.3      htmlwidgets_1.6.4
#> [33] pkgconfig_2.0.3   digest_0.6.39     R6_2.6.1          tidyselect_1.2.1 
#> [37] pillar_1.11.1     callr_3.8.0       magrittr_2.0.5    bslib_0.11.0     
#> [41] withr_3.0.3       tools_4.6.1       secretbase_1.3.0  cachem_1.1.0