TCGAbiolinks has provided a few functions to download and prepare data from GDC for analysis. This section starts by explaning the different downloads methods and the SummarizedExperiment object, which is the default data structure used in TCGAbiolinks, followed by some examples.
There are two methods to download GDC data using TCGAbiolinks:
chunks.per.download
argument which will split the files into small chunks, for example, if chunks.per.download is equal to 10 we will download only 10 files inside each tar.gz.A SummarizedExperiment object has three main matrices that can be accessed using the SummarizedExperiment package):
colData(data)
: stores sample information. TCGAbiolinks will add indexed clinical data and subtype information from marker TCGA papers.assay(data)
: stores molecular datarowRanges(data)
: stores metadata about the features, including their genomic rangesIn this example we will download gene expression data from legacy database (data aligned against genome of reference hg19) using GDC api method and we will show object data and metadata.
query <- GDCquery(project = "TCGA-GBM",
data.category = "Gene expression",
data.type = "Gene expression quantification",
platform = "Illumina HiSeq",
file.type = "normalized_results",
experimental.strategy = "RNA-Seq",
barcode = c("TCGA-14-0736-02A-01R-2005-01", "TCGA-06-0211-02A-02R-2005-01"),
legacy = TRUE)
GDCdownload(query, method = "api", chunks.per.download = 10)
data <- GDCprepare(query)
# Gene expression aligned against hg19.
datatable(as.data.frame(colData(data)),
options = list(scrollX = TRUE, keys = TRUE, pageLength = 5),
rownames = FALSE)
# Only first 100 to make render faster
datatable(assay(data)[1:100,],
options = list(scrollX = TRUE, keys = TRUE, pageLength = 5),
rownames = TRUE)
rowRanges(data)
In this example we will download gene expression quantification from harmonized database (data aligned against genome of reference hg38) using GDC Data Transfer Tool. Also, it shows the object data and metadata.
# Gene expression aligned against hg38
query <- GDCquery(project = "TCGA-GBM",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - Counts",
barcode = c("TCGA-14-0736-02A-01R-2005-01", "TCGA-06-0211-02A-02R-2005-01"))
tryCatch(GDCdownload(query, method = "client"),error = function(e)GDCdownload(query))
data <- GDCprepare(query)