1. Environment Set Up

knitr::opts_chunk$set(echo = TRUE, warning=FALSE)

Values of RMarkdown parameters

for (i in 1:length(params))
  print(paste('Parameter:', names(params)[i], ' - Value:', params[[i]], '- Class:', class(params[[i]])))
## [1] "Parameter: SEBio  - Value: ~/DataDir/bulkRNASeq/3.DataExploration/CTL04/Output/FemaleLineSE_Bio.rds - Class: character"
## [1] "Parameter: OutputFolder  - Value: ~/ - Class: character"
## [1] "Parameter: CpmFilt  - Value: 2 - Class: integer"
## [1] "Parameter: SampleFilt  - Value: 4 - Class: integer"
library(RNASeqBulkExploratory)  #Our Package
library(DT)
library(gridExtra)
library(SummarizedExperiment)
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## 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
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## The following object is masked from 'package:gridExtra':
## 
##     combine
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, aperm, append, as.data.frame, basename, cbind,
##     colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
##     get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
##     match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
##     Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
##     table, tapply, union, unique, unsplit, which.max, which.min
## Loading required package: S4Vectors
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
## 
##     expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
## 
##     rowMedians
## The following objects are masked from 'package:matrixStats':
## 
##     anyMissing, rowMedians
library(ggplot2)
SE_Bio <- readRDS(params$SEBio)
CpmFilt <- params$CpmFilt
SampleFilt <- params$SampleFilt
OutputFolder <- params$OutputFolder

2. Data Upload

SE_Filt <- filterSE(SE_Bio, cpmTh=CpmFilt, sampleTh=SampleFilt)
## UPDATED library.size slot
  • Re-calculate library size and calculate TMM
  • Calculate cpm and logCpm (with normalization) and store in SE_Filt
SE_Filt <- normTmmSE(SE_Filt, useNormFactors=TRUE, priorCount=0.25)  

3. Sample-to-sample correlation heatmap

Correlation matrix across samples calculated on the basis of the Spearman correlation.

# Set heatmap size on the basis of the number of samples
Width <- 7 + (dim(SE_Filt)[2]- 8) * 0.24
Width <- ifelse(Width<=14, Width, 14)
Height <- 5 + (dim(SE_Filt)[2]- 8) * 0.22
Cols <- c('DMSO' = 'grey30', 'CTL' = 'azure3', 
                 'AhHyd_Ag'='#F8766D', 'AhHyd_Inh'='#F8766D50',
                 'Andr_Ag'='#fccb17', 'Andr_Inh'='#C49A0050',  
                 "Estr_Ag"= '#53B400', "Estr_Inh"= '#53B40050', 
                 'GC_Ag' = '#00C094', 'GC_Inh' = '#00C09450',
                 'LivX_Ag' = '#00B6EB', 'LivX_Inh' = '#00B6EB50', 
                 'Ret_Ag' = '#A58AFF', 'Ret_Inh' = '#A58AFF50', 
                 'Thyr_Ag' = '#FB61D7', 'Thyr_Inh' = '#FB61D750'
                 )
sampleCorrHeatmap(
  SE_Filt,
  plotTitle = "Filtered dataset",
  annotation_col = c("Condition"),
  annotation_colors = list(
    Condition = Cols
  ),
  display_numbers = TRUE
)
## There are many samples. For readability "display_numbers" will be set to FALSE

cond_order <- c("CTL", "DMSO")
other_cond <- setdiff(unique(colData(SE_Filt)$Condition), cond_order)
cond_levels <- c(cond_order, sort(other_cond))
colData(SE_Filt)$Condition <- factor(
  colData(SE_Filt)$Condition,
  levels = cond_levels
)
ord <- order(colData(SE_Filt)$Condition)

SE_Filt_ord <- SE_Filt[, ord]
sampleCorrHeatmap(
  SE_Filt_ord,
  plotTitle = "Filtered dataset",
  annotation_col = c("Condition"),
  annotation_colors = list(
    Condition = Cols),
  display_numbers = TRUE,
  cluster_rows = FALSE,
  cluster_cols = FALSE,
  show_rownames = FALSE,
  show_colnames = FALSE
)
## There are many samples. For readability "display_numbers" will be set to FALSE

SessionInfo <- sessionInfo()
Date <- date()
SessionInfo
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [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    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] ggplot2_3.4.1               SummarizedExperiment_1.28.0
##  [3] Biobase_2.58.0              GenomicRanges_1.50.2       
##  [5] GenomeInfoDb_1.34.9         IRanges_2.32.0             
##  [7] S4Vectors_0.36.1            BiocGenerics_0.44.0        
##  [9] MatrixGenerics_1.10.0       matrixStats_0.63.0         
## [11] gridExtra_2.3               DT_0.27                    
## [13] RNASeqBulkExploratory_0.2.1
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.10            locfit_1.5-9.7         lattice_0.20-45       
##  [4] digest_0.6.31          utf8_1.2.3             R6_2.5.1              
##  [7] evaluate_0.20          highr_0.10             pillar_1.8.1          
## [10] zlibbioc_1.44.0        rlang_1.1.1            rstudioapi_0.14       
## [13] jquerylib_0.1.4        Matrix_1.5-3           rmarkdown_2.20        
## [16] textshaping_0.3.6      htmlwidgets_1.6.1      pheatmap_1.0.12       
## [19] RCurl_1.98-1.10        munsell_0.5.0          DelayedArray_0.24.0   
## [22] compiler_4.2.1         xfun_0.37              pkgconfig_2.0.3       
## [25] systemfonts_1.0.4      htmltools_0.5.4        tidyselect_1.2.0      
## [28] tibble_3.2.1           GenomeInfoDbData_1.2.9 edgeR_3.40.2          
## [31] fansi_1.0.4            dplyr_1.1.0            withr_2.5.0           
## [34] bitops_1.0-7           grid_4.2.1             jsonlite_1.8.4        
## [37] gtable_0.3.1           lifecycle_1.0.3        magrittr_2.0.3        
## [40] scales_1.2.1           cli_3.6.1              cachem_1.0.7          
## [43] farver_2.1.1           XVector_0.38.0         limma_3.54.1          
## [46] bslib_0.4.2            ragg_1.2.3             generics_0.1.3        
## [49] vctrs_0.6.2            RColorBrewer_1.1-3     tools_4.2.1           
## [52] glue_1.6.2             fastmap_1.1.1          yaml_2.3.7            
## [55] colorspace_2.1-0       knitr_1.42             sass_0.4.5
Date
## [1] "Tue Apr 28 13:08:37 2026"