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, colMeans, colSums, colnames,
##     dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
##     intersect, is.unsorted, lapply, lengths, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
##     rowMeans, rowSums, rownames, sapply, setdiff, sort, table,
##     tapply, union, unique, unsplit, which, which.max, which.min
## Loading required package: AnnotationHub
eh = ExperimentHub()
## snapshotDate(): 2018-04-27
query(eh , "GSE62944")
## ExperimentHub with 3 records
## # snapshotDate(): 2018-04-27 
## # $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 0 resources
## loading from cache 
##     '/home/biocbuild//.ExperimentHub/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
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.5.0 (2018-04-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.4 LTS
## 
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.7-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.7-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.20.0               SummarizedExperiment_1.10.0
##  [3] DelayedArray_0.6.0          BiocParallel_1.14.0        
##  [5] matrixStats_0.53.1          GenomicRanges_1.32.0       
##  [7] GenomeInfoDb_1.16.0         IRanges_2.14.0             
##  [9] S4Vectors_0.18.0            GSE62944_1.8.0             
## [11] GEOquery_2.48.0             Biobase_2.40.0             
## [13] ExperimentHub_1.6.0         AnnotationHub_2.12.0       
## [15] BiocGenerics_0.26.0         BiocStyle_2.8.0            
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-6                  bit64_0.9-7                  
##  [3] RColorBrewer_1.1-2            httr_1.3.1                   
##  [5] rprojroot_1.3-2               tools_3.5.0                  
##  [7] backports_1.1.2               R6_2.2.2                     
##  [9] rpart_4.1-13                  Hmisc_4.1-1                  
## [11] DBI_0.8                       lazyeval_0.2.1               
## [13] colorspace_1.3-2              nnet_7.3-12                  
## [15] gridExtra_2.3                 bit_1.1-12                   
## [17] curl_3.2                      compiler_3.5.0               
## [19] htmlTable_1.11.2              xml2_1.2.0                   
## [21] bookdown_0.7                  checkmate_1.8.5              
## [23] scales_0.5.0                  genefilter_1.62.0            
## [25] readr_1.1.1                   stringr_1.3.0                
## [27] digest_0.6.15                 foreign_0.8-70               
## [29] rmarkdown_1.9                 XVector_0.20.0               
## [31] base64enc_0.1-3               pkgconfig_2.0.1              
## [33] htmltools_0.3.6               limma_3.36.0                 
## [35] htmlwidgets_1.2               rlang_0.2.0                  
## [37] rstudioapi_0.7                RSQLite_2.1.0                
## [39] BiocInstaller_1.30.0          shiny_1.0.5                  
## [41] bindr_0.1.1                   acepack_1.4.1                
## [43] dplyr_0.7.4                   RCurl_1.95-4.10              
## [45] magrittr_1.5                  GenomeInfoDbData_1.1.0       
## [47] Formula_1.2-2                 Matrix_1.2-14                
## [49] Rcpp_0.12.16                  munsell_0.4.3                
## [51] stringi_1.1.7                 yaml_2.1.18                  
## [53] zlibbioc_1.26.0               plyr_1.8.4                   
## [55] grid_3.5.0                    blob_1.1.1                   
## [57] promises_1.0.1                lattice_0.20-35              
## [59] splines_3.5.0                 annotate_1.58.0              
## [61] hms_0.4.2                     locfit_1.5-9.1               
## [63] knitr_1.20                    pillar_1.2.2                 
## [65] geneplotter_1.58.0            XML_3.98-1.11                
## [67] glue_1.2.0                    evaluate_0.10.1              
## [69] latticeExtra_0.6-28           data.table_1.10.4-3          
## [71] httpuv_1.4.1                  gtable_0.2.0                 
## [73] purrr_0.2.4                   tidyr_0.8.0                  
## [75] assertthat_0.2.0              ggplot2_2.2.1                
## [77] xfun_0.1                      mime_0.5                     
## [79] xtable_1.8-2                  later_0.7.1                  
## [81] survival_2.42-3               tibble_1.4.2                 
## [83] AnnotationDbi_1.42.0          memoise_1.1.0                
## [85] bindrcpp_0.2.2                cluster_2.0.7-1              
## [87] interactiveDisplayBase_1.18.0