Skip to contents

This service returns information of subjects used in analyses from all datasets. Results may be filtered by dataset ID, subject ID, sex, age bracket or Hardy Scale. By default, this service queries the latest GTEx release.

GTEx Portal API documentation

Usage

get_subject(
  datasetId = "gtex_v8",
  sex = NULL,
  ageBrackets = NULL,
  hardyScale = NULL,
  subjectIds = NULL,
  page = 0,
  itemsPerPage = getOption("gtexr.itemsPerPage"),
  .verbose = getOption("gtexr.verbose"),
  .return_raw = FALSE
)

Arguments

datasetId

String. Unique identifier of a dataset. Usually includes a data source and data release. Options: "gtex_v8", "gtex_snrnaseq_pilot".

sex

String. Options: "male", "female".

ageBrackets

The age bracket(s) of the donors of interest. Options: "20-29", "30-39", "40-49", "50-59", "60-69", "70-79".

hardyScale

String A Hardy Scale of interest. Options: "Ventilator case", "Fast death - violent", "Fast death - natural causes", "Intermediate death", "Slow death".

subjectIds

Character vector. GTEx subject ID.

page

Integer (default = 0).

itemsPerPage

Integer (default = 250). Set globally to maximum value 100000 with options(list(gtexr.itemsPerPage = 100000)).

.verbose

Logical. If TRUE (default), print paging information. Set to FALSE globally with options(list(gtexr.verbose = FALSE)).

.return_raw

Logical. If TRUE, return the raw API JSON response. Default = FALSE

Value

A tibble. Or a list if .return_raw = TRUE.

Examples

get_subject()
#> Warning: ! Total number of items (979) exceeds the selected maximum page size (250).
#>  729 items were not retrieved.
#>  To retrieve all available items, increase `itemsPerPage`, ensuring you reuse
#>   your original query parameters e.g. `get_subject(<your_existing_parameters>,
#>   itemsPerPage = 100000)`
#>  Alternatively, adjust global "gtexr.itemsPerPage" setting e.g.
#>   `options(list(gtexr.itemsPerPage = 100000))`
#> 
#> ── Paging info ─────────────────────────────────────────────────────────────────
#>  numberOfPages = 4
#>  page = 0
#>  maxItemsPerPage = 250
#>  totalNumberOfItems = 979
#> # A tibble: 250 × 5
#>    hardyScale                  ageBracket subjectId  sex    datasetId
#>    <chr>                       <chr>      <chr>      <chr>  <chr>    
#>  1 Slow death                  60-69      GTEX-1117F female gtex_v8  
#>  2 Ventilator case             50-59      GTEX-111CU male   gtex_v8  
#>  3 Fast death - violent        60-69      GTEX-111FC male   gtex_v8  
#>  4 Intermediate death          60-69      GTEX-111VG male   gtex_v8  
#>  5 Ventilator case             60-69      GTEX-111YS male   gtex_v8  
#>  6 Ventilator case             60-69      GTEX-1122O female gtex_v8  
#>  7 Fast death - natural causes 60-69      GTEX-1128S female gtex_v8  
#>  8 NA                          60-69      GTEX-113IC male   gtex_v8  
#>  9 Fast death - natural causes 50-59      GTEX-113JC female gtex_v8  
#> 10 Fast death - natural causes 60-69      GTEX-117XS male   gtex_v8  
#> # ℹ 240 more rows