ukbflow is an R package for UK Biobank data analysis and
visualization, designed to work natively with the UK Biobank Research Analysis
Platform (RAP). It supports two working modes:
UK Biobank Data Policy (2024+): Individual-level phenotype and genotype data must remain within the RAP environment and cannot be downloaded locally. Only summary-level outputs (aggregated statistics, plots, reports) may be exported.
ukbflow dependencies are installed automatically with
the package.
The auth_* and job_* functions rely on the
dx command-line tool from dxpy. Required
only when running locally.
Verify:
Skip this step if you are running entirely within the RAP RStudio environment.
Obtain your API token from the DNAnexus platform under
Account Settings > API Tokens. Store it in your
.Renviron file (never in your script):
usethis::edit_r_environ()
# Add the following line, then save and restart R:
# DX_API_TOKEN=your_token_hereThen authenticate:
library(ukbflow)
auth_login() # reads DX_API_TOKEN automatically
auth_status() # confirm user and active project
auth_list_projects() # find your project ID
auth_select_project("project-XXXXXXXXXXXX") # switch to your UKB projectFor full details on token management, project selection, and both authentication modes, see
vignette("auth").
library(ukbflow)
packageVersion("ukbflow")
ops_setup() # checks R version, dxpy, DX_API_TOKEN, and key package versionsdx not foundSolution: Ensure dxpy is installed and on your PATH:
DNAnexus API tokens have a limited validity period. If authentication fails, generate a new token from the DNAnexus platform and log in again:
Solution: Install Rtools for packages that require compilation.