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
## 
## Attaching package: 'BiocGenerics'
## 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, aperm, 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, table, tapply,
##     union, unique, unsplit, which.max, which.min
## Loading required package: AnnotationHub
## Loading required package: BiocFileCache
## Loading required package: dbplyr
eh = ExperimentHub()
query(eh , "GSE62944")
## ExperimentHub with 3 records
## # snapshotDate(): 2023-10-24
## # $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 The...
##   EH1043 | RNA-Sequencing and clinical data for 9246 tumor samples from The...
##   EH1044 | RNA-Sequencing and clinical data for 741 normal samples from The...

One can then extract the data for this using

tcga_data <- eh[["EH1"]]
## see ?GSE62944 and browseVignettes('GSE62944') for documentation
## loading from cache

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 LUAD ... 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:utils':
## 
##     findMatches
## The following objects are masked from 'package:base':
## 
##     I, expand.grid, unname
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## 
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## The following object is masked from 'package:Biobase':
## 
##     rowMedians
ddsMat <- DESeqDataSetFromMatrix(countData = countData,
                                 colData = DataFrame(coldata),
                                 design = ~ Group)
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
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 Under development (unstable) (2023-10-22 r85388)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] DESeq2_1.43.0               SummarizedExperiment_1.33.0
##  [3] MatrixGenerics_1.15.0       matrixStats_1.0.0          
##  [5] GenomicRanges_1.55.1        GenomeInfoDb_1.39.0        
##  [7] IRanges_2.37.0              S4Vectors_0.41.1           
##  [9] GSE62944_1.31.0             GEOquery_2.71.0            
## [11] Biobase_2.63.0              ExperimentHub_2.11.0       
## [13] AnnotationHub_3.11.0        BiocFileCache_2.11.1       
## [15] dbplyr_2.4.0                BiocGenerics_0.49.0        
## [17] BiocStyle_2.31.0           
## 
## loaded via a namespace (and not attached):
##  [1] DBI_1.1.3                     bitops_1.0-7                 
##  [3] rlang_1.1.1                   magrittr_2.0.3               
##  [5] compiler_4.4.0                RSQLite_2.3.2                
##  [7] png_0.1-8                     vctrs_0.6.4                  
##  [9] pkgconfig_2.0.3               crayon_1.5.2                 
## [11] fastmap_1.1.1                 XVector_0.43.0               
## [13] ellipsis_0.3.2                utf8_1.2.4                   
## [15] promises_1.2.1                rmarkdown_2.25               
## [17] tzdb_0.4.0                    purrr_1.0.2                  
## [19] bit_4.0.5                     xfun_0.40                    
## [21] zlibbioc_1.49.0               cachem_1.0.8                 
## [23] jsonlite_1.8.7                blob_1.2.4                   
## [25] later_1.3.1                   DelayedArray_0.29.0          
## [27] BiocParallel_1.37.0           interactiveDisplayBase_1.41.0
## [29] parallel_4.4.0                R6_2.5.1                     
## [31] bslib_0.5.1                   limma_3.59.1                 
## [33] jquerylib_0.1.4               Rcpp_1.0.11                  
## [35] bookdown_0.36                 knitr_1.45                   
## [37] readr_2.1.4                   httpuv_1.6.12                
## [39] Matrix_1.6-1.1                tidyselect_1.2.0             
## [41] abind_1.4-5                   yaml_2.3.7                   
## [43] codetools_0.2-19              curl_5.1.0                   
## [45] lattice_0.22-5                tibble_3.2.1                 
## [47] shiny_1.7.5.1                 withr_2.5.2                  
## [49] KEGGREST_1.43.0               evaluate_0.22                
## [51] xml2_1.3.5                    Biostrings_2.71.1            
## [53] pillar_1.9.0                  BiocManager_1.30.22          
## [55] filelock_1.0.2                generics_0.1.3               
## [57] RCurl_1.98-1.12               BiocVersion_3.19.1           
## [59] hms_1.1.3                     ggplot2_3.4.4                
## [61] munsell_0.5.0                 scales_1.2.1                 
## [63] xtable_1.8-4                  glue_1.6.2                   
## [65] tools_4.4.0                   data.table_1.14.8            
## [67] locfit_1.5-9.8                grid_4.4.0                   
## [69] tidyr_1.3.0                   AnnotationDbi_1.65.0         
## [71] colorspace_2.1-0              GenomeInfoDbData_1.2.11      
## [73] cli_3.6.1                     rappdirs_0.3.3               
## [75] fansi_1.0.5                   S4Arrays_1.3.0               
## [77] dplyr_1.1.3                   gtable_0.3.4                 
## [79] sass_0.4.7                    digest_0.6.33                
## [81] SparseArray_1.3.0             memoise_2.0.1                
## [83] htmltools_0.5.6.1             lifecycle_1.0.3              
## [85] httr_1.4.7                    statmod_1.5.0                
## [87] mime_0.12                     bit64_4.0.5