Using RTCGA package to download CNV data that are included in RTCGA.CNV package

Date of datasets release: 2015-11-01

Przemyslaw Biecek


RTCGA package

The 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 an benefcial infuence on impact on development of science and improvement of patients’ treatment. RTCGA is an open-source R package, available to download from Bioconductor

if (!requireNamespace("BiocManager", quietly=TRUE))

or from github

if (!require(devtools)) {

Furthermore, RTCGA package transforms TCGA data to 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:


How to download CNV data (i.e. copy number variation) to gain the same datasets as in RTCGA.CNV package?

There are many available date times of TCGA data releases. To see them all just type:


Version 1.0 of RTCGA.CNV package contains clinical datasets from 2015-11-01. There were downloaded as follows (which is mainly copied from

Available cohorts

All cohort names can be checked using:

(cohorts <- infoTCGA() %>% 
   rownames() %>% 
   sub("-counts", "", x=.))

For all cohorts the following code downloads the CNV data.

Downloading files

#dir.create( "data/CNV2" )
releaseDate <- "2015-11-01"
for (cohort in cohorts) {
  try(downloadTCGA( cancerTypes = cohort, destDir = "data/CNV2", date = releaseDate, dataSet = "Merge_snp__genome_wide_snp_6__broad_mit_edu__Level_3__segmented_scna_minus_germline_cnv_hg19__seg.Level_3" ),

Reading downloaded CNV dataset

Datasets from the folder data/CNV2 are imported and transformed into rda files.

allCNVFiles <- list.files("data/CNV2", pattern = "cnv", recursive = TRUE, full.names = TRUE)
for (CNVFile in allCNVFiles) {
    CNV <- read.table(CNVFile,h=T) 
    cohortName <- strsplit(strsplit(CNVFile, split = "/")[[1]][4], "\\.")[[1]][1]
    name = paste0(cohortName, ".CNV")
    assign(name, CNV)
    save(list = name, file=paste0("data/CNV2/", name, ".rda"), compression_level = 9, compress = "xz")


Saving CNV data to RTCGA.CNV package

Now you should copy all rda files into the RTCGA.CNV package data directory.