The GDC requires an auth token for downloading data that are "controlled access". For example, BAM files for human datasets, germline variant calls, and SNP array raw data all are protected as "controlled access". For these files, a GDC access token is required. See the https://docs.gdc.cancer.gov/Data_Portal/Users_Guide/Authentication/#gdc-authentication-tokens. Note that this function simply returns a string value. It is possible to keep the GDC token in a variable in R or to pass a string directly to the appropriate parameter. This function is simply a convenience function for alternative approaches to get a token from an environment variable or a file.
Details
This function will resolve locations of the GDC token in the following order:
from the environment variable,
GDC_TOKEN
, expected to contain the token downloaded from the GDC as a stringusing
readLines
to read a file named in the environment variable,GDC_TOKEN_FILE
using
readLines
to read from a file called.gdc_token
in the user's home directory
If all of these fail, this function will return an error.
References
https://docs.gdc.cancer.gov/Data_Portal/Users_Guide/Authentication/#gdc-authentication-tokens
Examples
# This will not run before a GDC token
# is in place.
token = try(gdc_token(),silent=TRUE)