RTCGA
package to download clinical data that are included in RTCGA.clinical
packageThe Cancer Genome Atlas (TCGA) Data Portal provides a platform for researchers to search, download, and analyze data sets generated by TCGA. It contains clinical information, genomic characterization data, and high level sequence analysis of the tumor genomes. The key is to understand genomics to improve cancer care.
RTCGA
package offers download and integration of the variety and volume of TCGA data using patient barcode key, what enables easier data possession. This may have a benefcial infuence on development of science and improvement of patients’ treatment. RTCGA
is an open-source R package, available to download from Bioconductor
or from github
Furthermore, RTCGA
package transforms TCGA data into form which is convenient to use in R statistical package. Those data transformations can be a part of statistical analysis pipeline which can be more reproducible with RTCGA
.
Use cases and examples are shown in RTCGA
packages vignettes:
There are many available date times of TCGA data releases. To see them all just type:
Version 20151101.. of RTCGA.clinical
package contains clinical datasets which were released 2015-11-01
. They were downloaded in the following way (which is mainly copied from http://rtcga.github.io/RTCGA/:
All cohort names can be checked using:
For all cohorts the following code downloads the RPPA data.
# dir.create( "data2" ) # name of a directory in which data will be stored
releaseDate <- "2015-11-01"
sapply( cohorts, function(element){
tryCatch({
downloadTCGA( cancerTypes = element,
destDir = "data2",
date = releaseDate )},
error = function(cond){
cat("Error: Maybe there weren't clinical data for ", element, " cancer.\n")
}
)
})
NA
files from data2 folderIf there were not clinical data for some cohorts we should remove corresponding NA
files.
Below is the code that automatically assigns paths to files for all clinical files for all available cohorts types downloaded to data2
folder.
readTCGA
Because of the fact that clinical data are transposed in downloaded files, there has been prepared special function readTCGA
to read and transpose data automatically. Code is below
ls() %>%
grep("clinical\\.path", x = ., value = TRUE) %>%
sapply(function(element){
tryCatch({
readTCGA(get(element, envir = .GlobalEnv),
dataType = "clinical") -> clinical_file
## remove non-ASCII strings:
for( i in 1:ncol(clinical_file)){
clinical_file[, i] <- iconv(clinical_file[, i],
"UTF-8", "ASCII", sub="")
}
assign(value = clinical_file,
x = sub("\\.path", "", x = element),
envir = .GlobalEnv )
}, error = function(cond){
cat(element)
})
invisible(NULL)
}
)
RTCGA.clinical
packagegrep( "clinical", ls(), value = TRUE) %>%
grep("path", x=., value = TRUE, invert = TRUE) %>%
cat( sep="," ) #can one to it better? as from use_data documentation:
# ... Unquoted names of existing objects to save
devtools::use_data(ACC.clinical,BLCA.clinical,BRCA.clinical,
CESC.clinical,CHOL.clinical,COAD.clinical,
COADREAD.clinical,DLBC.clinical,ESCA.clinical,
FPPP.clinical,GBM.clinical,GBMLGG.clinical,
HNSC.clinical,KICH.clinical,KIPAN.clinical,
KIRC.clinical,KIRP.clinical,LAML.clinical,
LGG.clinical,LIHC.clinical,LUAD.clinical,
LUSC.clinical,MESO.clinical,OV.clinical,
PAAD.clinical,PCPG.clinical,PRAD.clinical,
READ.clinical,SARC.clinical,SKCM.clinical,
STAD.clinical,STES.clinical,TGCT.clinical,
THCA.clinical,THYM.clinical,UCEC.clinical,
UCS.clinical,UVM.clinical,
compress="xz")