Retrieve the expression data matrix of a set of datasets and genes

get_dataset_expression_for_genes(
  datasets,
  genes,
  keepNonSpecific = FALSE,
  consolidate = NA_character_,
  raw = getOption("gemma.raw", FALSE),
  memoised = getOption("gemma.memoised", FALSE),
  file = getOption("gemma.file", NA_character_),
  overwrite = getOption("gemma.overwrite", FALSE)
)

Arguments

datasets

A numerical dataset identifier or a dataset short name

genes

An ensembl gene identifier which typically starts with ensg or an ncbi gene identifier or an official gene symbol approved by hgnc

keepNonSpecific

logical. FALSE by default. If TRUE, results from probesets that are not specific to the gene will also be returned.

consolidate

An option for gene expression level consolidation. If empty, will return every probe for the genes. "pickmax" to pick the probe with the highest expression, "pickvar" to pick the prove with the highest variance and "average" for returning the average expression

raw

TRUE to receive results as-is from Gemma, or FALSE to enable parsing. Raw results usually contain additional fields and flags that are omitted in the parsed results.

memoised

Whether or not to save to cache for future calls with the same inputs and use the result saved in cache if a result is already saved. Doing options(gemma.memoised = TRUE) will ensure that the cache is always used. Use forget_gemma_memoised to clear the cache.

file

The name of a file to save the results to, or NULL to not write results to a file. If raw == TRUE, the output will be the raw endpoint from the API, likely a JSON or a gzip file. Otherwise, it will be a RDS file.

overwrite

Whether or not to overwrite if a file exists at the specified filename.

Value

A list of data frames

Examples

get_dataset_expression_for_genes("GSE2018", genes = c(10225, 2841))
#> $`1`
#>        Probe GeneSymbol NCBIid BAL_1_A0B0 BAL_27a_A0B0 BAL_43_A0B0 BAL_13_A0B0
#>       <char>     <char>  <int>      <num>        <num>       <num>       <num>
#> 1: 210279_at      GPR18   2841   4.637970     4.654372    4.447625    4.688759
#> 2: 206761_at       CD96  10225   4.406503     4.721373    4.488685    4.725440
#>    BAL_29_A1B0 BAL_44b_A0B0 BAL_18_A1B0 BAL_31_A0B1 BAL_45b_A2B0 BAL_20a_A1B1
#>          <num>        <num>       <num>       <num>        <num>        <num>
#> 1:    4.691512     4.556524    4.569245    4.874795     5.948961          NaN
#> 2:    4.661147     4.386026    4.374732    4.550056     5.268057          NaN
#>    BAL_39_A0B1 BAL_47a_A0B0 BAL_37_A1B1 BAL_21_A0B0 BAL_40_A0B0 BAL_47c_A0B1
#>          <num>        <num>       <num>       <num>       <num>        <num>
#> 1:    4.660488     4.582546    5.837180    4.784791    4.686329     4.648810
#> 2:    4.443481     4.525138    5.227731    4.731956    4.662121     4.542716
#>    BAL_15b_A0B0 BAL_26_A2B0 BAL_42_A0B0 BAL_12_A1B0 BAL_27b_A2B1 BAL_44a_A0B0
#>           <num>       <num>       <num>       <num>        <num>        <num>
#> 1:     4.768349    5.232383    4.663407    4.654849     5.266263     4.538479
#> 2:     4.712064    4.887611    4.580567    4.503594     5.003438     4.480109
#>    BAL_17_A0B0 BAL_3_A1B0 BAL_45a_A1B0 BAL_19_A0B0 BAL_33_A0B1 BAL_46_A2B0
#>          <num>      <num>        <num>       <num>       <num>       <num>
#> 1:    4.509543   4.821701     4.656690    4.746777    4.460669    5.469026
#> 2:    4.415465   4.677616     4.541356    4.568647    4.512166    5.013087
#>    BAL_20b_A1B1 BAL_4_A0B0 BAL_47b_A0B1 BAL_15a_A0B1 BAL_25_A0B0 BAL_41_A1B0
#>           <num>      <num>        <num>        <num>       <num>       <num>
#> 1:     5.831111   4.695328     4.692016     4.562564    4.483595    4.471560
#> 2:     5.258778   4.656544     4.582452     4.443919    4.437924    4.656262
#> 
#> attr(,"call")
#> [1] "https://gemma.msl.ubc.ca/rest/v2/datasets/GSE2018/expressions/genes/10225%2C2841?keepNonSpecific=false"
#> attr(,"env")
#> <environment: 0x5575b1a958c8>