Contents

1 DE analysis with Raw TCGA data using Bioconductor’s ExperimentHub and DESeq2

TCGA re-processed RNA-Seq data from 9264 Tumor Samples and 741 normal samples across 24 cancer types and made it available via GSE62944 from GEO. This data is also available as an ExpressionSet from ExperimentHub and can be used for Differential Expression Analysis.

In the below example, we show how one can download this dataset from ExperimentHub.

library(ExperimentHub)
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
##     as.data.frame, basename, cbind, colnames, dirname, do.call,
##     duplicated, eval, evalq, get, grep, grepl, intersect,
##     is.unsorted, lapply, mapply, match, mget, order, paste, pmax,
##     pmax.int, pmin, pmin.int, rank, rbind, rownames, sapply,
##     setdiff, sort, table, tapply, union, unique, unsplit, which,
##     which.max, which.min
## Loading required package: AnnotationHub
## Loading required package: BiocFileCache
## Loading required package: dbplyr
eh = ExperimentHub()
## snapshotDate(): 2019-05-07
query(eh , "GSE62944")
## ExperimentHub with 3 records
## # snapshotDate(): 2019-05-07 
## # $dataprovider: GEO
## # $species: Homo sapiens
## # $rdataclass: SummarizedExperiment, ExpressionSet
## # additional mcols(): taxonomyid, genome, description,
## #   coordinate_1_based, maintainer, rdatadateadded, preparerclass,
## #   tags, rdatapath, sourceurl, sourcetype 
## # retrieve records with, e.g., 'object[["EH1"]]' 
## 
##            title                                                           
##   EH1    | RNA-Sequencing and clinical data for 7706 tumor samples from ...
##   EH1043 | RNA-Sequencing and clinical data for 9246 tumor samples from ...
##   EH1044 | RNA-Sequencing and clinical data for 741 normal samples from ...

One can then extract the data for this using

tcga_data <- eh[["EH1"]]
## see ?GSE62944 and browseVignettes('GSE62944') for documentation
## downloading 1 resources
## retrieving 1 resource
## loading from cache 
##     'EH1 : 1'

The different cancer types can be accessed using -

 head(phenoData(tcga_data)$CancerType)
## [1] GBM GBM GBM GBM GBM OV 
## 20 Levels: BLCA BRCA COAD GBM HNSC KICH KIRC KIRP LAML LGG LIHC ... UCEC

Above we show only the top 6 Cancer subtypes.

1.1 Case Study

We are interested in identifying the IDH1 mutant and IDH1 wild type samples from TCGA’s Low Grade Glioma Samples and then conducting a differential expression analysis using DESeq2

# subset the expression Set to contain only samples from LGG.
lgg_data <- tcga_data[, which(phenoData(tcga_data)$CancerType=="LGG")]

# extract the IDHI mutant samples
mut_idx <- which(phenoData(lgg_data)$idh1_mutation_found=="YES")
mut_data <- exprs(lgg_data)[, mut_idx]

# extract the IDH1 WT samples
wt_idx <- which(phenoData(lgg_data)$idh1_mutation_found=="NO")
wt_data <- exprs(lgg_data)[, wt_idx]

# make a countTable.
countData <- cbind(mut_data, wt_data)

# for DE analysis with DESeq2 we need a sampleTable
samples= c(colnames(mut_data), colnames(wt_data))
group =c(rep("mut",length(mut_idx)), rep("wt", length(wt_idx)))
coldata <- cbind(samples, group)
colnames(coldata) <- c("sampleName", "Group")
coldata[,"Group"] <- factor(coldata[,"Group"], c("wt","mut"))

# Now we can run DE analysis
library(DESeq2)
## Loading required package: S4Vectors
## Loading required package: stats4
## 
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: DelayedArray
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## Loading required package: BiocParallel
## 
## Attaching package: 'DelayedArray'
## The following objects are masked from 'package:matrixStats':
## 
##     colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
## The following objects are masked from 'package:base':
## 
##     aperm, apply, rowsum
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
ddsMat <- DESeqDataSetFromMatrix(countData = countData,
                                 colData = DataFrame(coldata),
                                 design = ~ Group)

dds <- ddsMat
dds <- dds[ rowSums(counts(dds)) > 1, ]
dds <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 865 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
res <- results(dds) 
summary(res)
## 
## out of 22546 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up)       : 2892, 13%
## LFC < 0 (down)     : 5094, 23%
## outliers [1]       : 0, 0%
## low counts [2]     : 1749, 7.8%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results

For a detailed RNASeq analysis see Mike Love’s RNASeq workflow

2 sessionInfo()

sessionInfo()
## R version 3.6.0 (2019-04-26)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.10-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.10-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats4    parallel  stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] DESeq2_1.25.0               SummarizedExperiment_1.15.0
##  [3] DelayedArray_0.11.0         BiocParallel_1.19.0        
##  [5] matrixStats_0.54.0          GenomicRanges_1.37.0       
##  [7] GenomeInfoDb_1.21.0         IRanges_2.19.0             
##  [9] S4Vectors_0.23.0            GSE62944_1.13.0            
## [11] GEOquery_2.53.0             Biobase_2.45.0             
## [13] ExperimentHub_1.11.1        AnnotationHub_2.17.2       
## [15] BiocFileCache_1.9.0         dbplyr_1.4.0               
## [17] BiocGenerics_0.31.0         BiocStyle_2.13.0           
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-6                  bit64_0.9-7                  
##  [3] RColorBrewer_1.1-2            httr_1.4.0                   
##  [5] backports_1.1.4               tools_3.6.0                  
##  [7] R6_2.4.0                      rpart_4.1-15                 
##  [9] Hmisc_4.2-0                   DBI_1.0.0                    
## [11] lazyeval_0.2.2                colorspace_1.4-1             
## [13] nnet_7.3-12                   tidyselect_0.2.5             
## [15] gridExtra_2.3                 bit_1.1-14                   
## [17] curl_3.3                      compiler_3.6.0               
## [19] htmlTable_1.13.1              xml2_1.2.0                   
## [21] bookdown_0.9                  scales_1.0.0                 
## [23] checkmate_1.9.3               genefilter_1.67.0            
## [25] readr_1.3.1                   rappdirs_0.3.1               
## [27] stringr_1.4.0                 digest_0.6.18                
## [29] foreign_0.8-71                rmarkdown_1.12               
## [31] XVector_0.25.0                base64enc_0.1-3              
## [33] pkgconfig_2.0.2               htmltools_0.3.6              
## [35] limma_3.41.0                  htmlwidgets_1.3              
## [37] rlang_0.3.4                   rstudioapi_0.10              
## [39] RSQLite_2.1.1                 shiny_1.3.2                  
## [41] acepack_1.4.1                 dplyr_0.8.0.1                
## [43] RCurl_1.95-4.12               magrittr_1.5                 
## [45] GenomeInfoDbData_1.2.1        Formula_1.2-3                
## [47] Matrix_1.2-17                 Rcpp_1.0.1                   
## [49] munsell_0.5.0                 stringi_1.4.3                
## [51] yaml_2.2.0                    zlibbioc_1.31.0              
## [53] plyr_1.8.4                    grid_3.6.0                   
## [55] blob_1.1.1                    promises_1.0.1               
## [57] crayon_1.3.4                  lattice_0.20-38              
## [59] splines_3.6.0                 annotate_1.63.0              
## [61] hms_0.4.2                     locfit_1.5-9.1               
## [63] knitr_1.22                    pillar_1.3.1                 
## [65] geneplotter_1.63.0            XML_3.98-1.19                
## [67] glue_1.3.1                    evaluate_0.13                
## [69] latticeExtra_0.6-28           data.table_1.12.2            
## [71] BiocManager_1.30.4            httpuv_1.5.1                 
## [73] gtable_0.3.0                  purrr_0.3.2                  
## [75] tidyr_0.8.3                   assertthat_0.2.1             
## [77] ggplot2_3.1.1                 xfun_0.6                     
## [79] mime_0.6                      xtable_1.8-4                 
## [81] later_0.8.0                   survival_2.44-1.1            
## [83] tibble_2.1.1                  AnnotationDbi_1.47.0         
## [85] memoise_1.1.0                 cluster_2.0.9                
## [87] interactiveDisplayBase_1.23.0