Last updated: 2020-06-23
Checks: 7 0
Knit directory: methyl-geneset-testing/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20200302)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 6aa0ab0. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: code/.job/
Ignored: code/old/
Ignored: data/
Ignored: output/FDR-analysis/
Ignored: output/Fig-1A.pdf
Ignored: output/Fig-1B.pdf
Ignored: output/Fig-1C.pdf
Ignored: output/Fig-1D.pdf
Ignored: output/Fig-3A.pdf
Ignored: output/Fig-3B.pdf
Ignored: output/Fig-3C.pdf
Ignored: output/Fig-3D.pdf
Ignored: output/Fig-4A.pdf
Ignored: output/Fig-4B.pdf
Ignored: output/Fig-4C-G.pdf
Ignored: output/SFig-1A.pdf
Ignored: output/SFig-1B.pdf
Ignored: output/SFig-3A.pdf
Ignored: output/SFig-3B.pdf
Ignored: output/SFig-4B.pdf
Ignored: output/SFig-5B.pdf
Ignored: output/SFig-6A.pdf
Ignored: output/SFig-6B-F.pdf
Ignored: output/SFig-7A.pdf
Ignored: output/SFig-7B-F.pdf
Ignored: output/SFig-8A.pdf
Ignored: output/SFig-8B-F.pdf
Ignored: output/SFig-X1.pdf
Ignored: output/SFig-X2.pdf
Ignored: output/compare-methods/
Ignored: output/methylgsa-params/
Ignored: output/random-cpg-sims/
Unstaged changes:
Modified: analysis/exploreArrayBias450.Rmd
Modified: analysis/exploreData.Rmd
Modified: code/utility.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/fdrAnalysis.Rmd
) and HTML (docs/fdrAnalysis.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 6aa0ab0 | Jovana Maksimovic | 2020-06-23 | wflow_publish(c(“analysis/fdrAnalysis.Rmd”)) |
Rmd | 823b793 | Jovana Maksimovic | 2020-06-16 | UPdated analyses with label translation and new colour palette. |
html | 22f00e9 | Jovana Maksimovic | 2020-05-19 | Build site. |
Rmd | 63b0011 | Jovana Maksimovic | 2020-05-19 | wflow_publish(c(“analysis/exploreArrayBias450.Rmd”, “analysis/exploreArrayBiasEPIC.Rmd”, |
html | 7af677c | Jovana Maksimovic | 2020-04-17 | Build site. |
Rmd | 0fec41a | Jovana Maksimovic | 2020-04-17 | Completed repeat of FDR analysis using TCGA data |
Rmd | f42dc82 | JovMaksimovic | 2020-04-14 | Updated all FDR analysis code. |
Rmd | 1ea3283 | JovMaksimovic | 2020-04-14 | Updated null analysis with KIRC TCGA data |
library(here)
library(minfi)
library(paletteer)
library(limma)
library(reshape2)
library(missMethyl)
library(ggplot2)
library(glue)
library(tibble)
library(dplyr)
library(curatedTCGAData)
library(MultiAssayExperiment)
library(TCGAutils)
library(DMRcate)
library(patchwork)
source(here("code/utility.R"))
We are using publicly available kidney clear cell carcinoma (KIRC) 450k data from The Cancer Genome Atlas (TCGA). We are using only the normal samples to look at false discovery rate control by various methylation gene set testing methods.
Download the data using the curatedTCGAData
Bioconductor package and then extract the normal samples. The data seems to have already been normalised(?) so we will only remove poor probes (>1 NA), SNP, multi-mapping and sex-chromosome probes.
kirc <- curatedTCGAData(diseaseCode = "KIRC", assays = "Methylation_methyl450",
dry.run = FALSE)
kirc <- splitAssays(kirc, c("11")) # extract only the normal samples
exp <- experiments(kirc)[[1]]
meta <- colData(kirc)
betas <- as.matrix(assay(exp))
colnames(betas) <- substr(colnames(betas), 1, 12)
m <- match(colnames(betas), meta$patientID)
meta <- meta[m, ]
head(meta[, 1:5])
betasNoNA <- betas[rowSums(is.na(betas)) == 0, ]
mds <- plotMDS(betasNoNA, gene.selection = "common", plot = FALSE)
dat <- tibble(x = mds$x, y = mds$y, gender = meta$gender)
ggplot(dat, aes(x = x, y = y, colour = gender)) +
geom_point() +
labs(x = "Principal Component 1", y = "Principal Component 2",
colour = "Sex")
betasFlt <- rmSNPandCH(betasNoNA, rmXY = TRUE, rmcrosshyb = TRUE)
mds <- plotMDS(betasFlt, gene.selection = "common", plot = FALSE)
dat <- tibble(x = mds$x, y = mds$y, gender = meta$gender)
pal <- paletteer::paletteer_d("wesanderson::Moonrise3", 2)
cols <- c("female" = pal[2], "male" = pal[1])
p <- ggplot(dat, aes(x = x, y = y, colour = gender)) +
geom_point(size = 3) +
labs(x = "Principal Component 1", y = "Principal Component 2",
colour = "Sex") +
scale_color_manual(values = cols)
p
fig <- here("output/Fig-3C.pdf")
pdf(file = fig, width = 9)
p
dev.off()
dat$age <- meta$years_to_birth
dat$race <- sub(" or", "\nor", meta$race)
dat$ethnicity <- sub(" or", "\nor", meta$ethnicity)
a <- ggplot(dat, aes(x = x, y = y, colour = age)) +
geom_point() +
labs(x = "Principal Component 1", y = "Principal Component 2",
colour = "Age") +
viridis::scale_color_viridis(direction = -1)
b <- ggplot(dat, aes(x = x, y = y, colour = race)) +
geom_point() +
labs(x = "Principal Component 1", y = "Principal Component 2",
colour = "Race") +
theme(legend.text = element_text(size = 7))
c <- ggplot(dat, aes(x = x, y = y, colour = ethnicity)) +
geom_point() +
labs(x = "Principal Component 1", y = "Principal Component 2",
colour = "Ethnicity") +
theme(legend.text = element_text(size = 7))
(b + c) / a
Version | Author | Date |
---|---|---|
22f00e9 | Jovana Maksimovic | 2020-05-19 |
dat <- as_tibble(melt(betasFlt))
colnames(dat) <- c("cpg", "ID", "beta")
p <- ggplot(dat, aes(x = beta)) +
geom_line(aes(color = ID), stat="density", size=0.5, alpha=0.5,
show.legend = FALSE)
p + labs(x = "Beta value", y = "Density")
Run 100 null simulations comparing 5, 10, 20, 40, 80 randomly selected samples per “group”. There should be no significant differential methylation between the groups as the data contains no signal. Consequently, we expect about 5% false gene set discoveries across the 100 simulations from methods that are “holding their size”. We will compare gometh (with top 1000 and 5000 ranked CpGs selected), MethylGSA:GLM, MethylGSM:ORA, MethylGSA:GSEA and ChAMP:ebGSEA for the complete list of BROAD gene sets provided in the ChAMP package.
outFile <- here("data/TCGA.KIRC.rds")
if(!file.exists(outFile)){
saveRDS(betasFlt, file = outFile)
}
Load the results of the FDR simulations.
inFile <- here("output/FDR-analysis/FDR-analysis.rds")
if(file.exists(inFile)) dat <- as_tibble(readRDS(inFile))
The plots below shows that MethylGSA-ORA does not control the false discovery rate very well as the median proportion of p-value 0.05 for the 100 simulations is greater than 0.5. MethylGSA-GSEA does better, although its median false discovery rate is still relatively high at around 0.25. MethylGSA-GLM has good false discovery rate control with median FDR at around 0.05. ChAMP-ebGSEA is only slightly anti-conservative using both the wicox test (WT) and known population median test (KPMT) with a median FDR at around 0.06-0.08. MissMethyl-gometh is very consistent although somewhat conservative with a median FDR at around 0.02-0.03.
dat %>% mutate(method = unname(dict[method])) %>%
group_by(simNo, sampleNo, method) %>%
summarise(psig = sum(pvalue < 0.05)/length(pvalue)) %>%
mutate(sampleOrd = as.integer(sampleNo)) -> sigDat
p <- ggplot(sigDat, aes(x = reorder(sampleNo, sampleOrd), y = psig,
fill = method)) +
geom_violin(scale = "width", width = 0.8) +
stat_summary(geom = "point", size = 1, color = "white",
position = position_dodge(0.8),
show.legend = FALSE, fun = median) +
geom_hline(yintercept=0.05, linetype="dashed", color = "red") +
labs(y="Prop. gene sets with p-value < 0.05", x="No. samples per group",
fill="Method") +
scale_fill_manual(values = methodCols)
p
fig <- here("output/Fig-3D.pdf")
pdf(file = fig, width = 9)
p
dev.off()
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /config/RStudio/R/3.6.1/lib64/R/lib/libRblas.so
LAPACK: /config/RStudio/R/3.6.1/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] DMRcatedata_2.2.1 ExperimentHub_1.12.0
[3] AnnotationHub_2.18.0 BiocFileCache_1.10.2
[5] dbplyr_1.4.2 rhdf5_2.30.1
[7] patchwork_1.0.0 DMRcate_2.0.7
[9] TCGAutils_1.6.2 curatedTCGAData_1.8.1
[11] MultiAssayExperiment_1.12.6 dplyr_0.8.5
[13] tibble_3.0.1 glue_1.4.1
[15] ggplot2_3.3.0 missMethyl_1.20.4
[17] reshape2_1.4.3 limma_3.42.2
[19] paletteer_1.1.0 minfi_1.32.0
[21] bumphunter_1.26.0 locfit_1.5-9.1
[23] iterators_1.0.12 foreach_1.5.0
[25] Biostrings_2.54.0 XVector_0.24.0
[27] SummarizedExperiment_1.16.1 DelayedArray_0.12.3
[29] BiocParallel_1.20.1 matrixStats_0.56.0
[31] Biobase_2.46.0 GenomicRanges_1.38.0
[33] GenomeInfoDb_1.22.1 IRanges_2.20.2
[35] S4Vectors_0.24.4 BiocGenerics_0.32.0
[37] here_0.1 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] rappdirs_0.3.1
[2] rtracklayer_1.44.4
[3] R.methodsS3_1.7.1
[4] pkgmaker_0.27
[5] tidyr_1.1.0
[6] acepack_1.4.1
[7] bit64_0.9-7
[8] knitr_1.28
[9] R.utils_2.9.0
[10] data.table_1.12.8
[11] rpart_4.1-15
[12] RCurl_1.95-4.12
[13] GEOquery_2.54.1
[14] AnnotationFilter_1.8.0
[15] GenomicFeatures_1.36.4
[16] preprocessCore_1.48.0
[17] RSQLite_2.1.2
[18] bit_1.1-14
[19] xml2_1.3.2
[20] httpuv_1.5.2
[21] assertthat_0.2.1
[22] IlluminaHumanMethylation450kmanifest_0.4.0
[23] viridis_0.5.1
[24] IlluminaHumanMethylationEPICanno.ilm10b4.hg19_0.6.0
[25] xfun_0.14
[26] hms_0.5.3
[27] evaluate_0.14
[28] promises_1.1.0
[29] scrime_1.3.5
[30] progress_1.2.2
[31] readxl_1.3.1
[32] DBI_1.0.0
[33] htmlwidgets_1.3
[34] reshape_0.8.8
[35] purrr_0.3.4
[36] ellipsis_0.3.1
[37] backports_1.1.7
[38] permute_0.9-5
[39] prismatic_0.2.0
[40] annotate_1.62.0
[41] biomaRt_2.42.1
[42] vctrs_0.3.0
[43] ensembldb_2.8.0
[44] withr_2.2.0
[45] Gviz_1.28.3
[46] BSgenome_1.52.0
[47] checkmate_2.0.0
[48] GenomicAlignments_1.20.1
[49] prettyunits_1.1.1
[50] mclust_5.4.6
[51] cluster_2.1.0
[52] GenomicDataCommons_1.10.0
[53] lazyeval_0.2.2
[54] crayon_1.3.4
[55] genefilter_1.68.0
[56] labeling_0.3
[57] edgeR_3.26.8
[58] pkgconfig_2.0.3
[59] nlme_3.1-147
[60] ProtGenerics_1.16.0
[61] palr_0.2.0
[62] nnet_7.3-12
[63] pals_1.6
[64] rlang_0.4.6
[65] lifecycle_0.2.0
[66] registry_0.5-1
[67] dichromat_2.0-0
[68] cellranger_1.1.0
[69] rprojroot_1.3-2
[70] rngtools_1.4
[71] IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
[72] base64_2.0
[73] Matrix_1.2-18
[74] Rhdf5lib_1.6.1
[75] base64enc_0.1-3
[76] whisker_0.4
[77] viridisLite_0.3.0
[78] oompaBase_3.2.9
[79] bitops_1.0-6
[80] R.oo_1.22.0
[81] blob_1.2.0
[82] DelayedMatrixStats_1.8.0
[83] doRNG_1.7.1
[84] stringr_1.4.0
[85] nor1mix_1.3-0
[86] readr_1.3.1
[87] IlluminaHumanMethylationEPICmanifest_0.3.0
[88] scales_1.1.1
[89] memoise_1.1.0
[90] magrittr_1.5
[91] plyr_1.8.6
[92] bibtex_0.4.2
[93] zlibbioc_1.30.0
[94] compiler_3.6.1
[95] RColorBrewer_1.1-2
[96] illuminaio_0.28.0
[97] Rsamtools_2.0.1
[98] DSS_2.34.0
[99] htmlTable_1.13.2
[100] Formula_1.2-3
[101] MASS_7.3-51.6
[102] tidyselect_1.1.0
[103] stringi_1.4.6
[104] yaml_2.2.1
[105] askpass_1.1
[106] latticeExtra_0.6-28
[107] grid_3.6.1
[108] VariantAnnotation_1.30.1
[109] tools_3.6.1
[110] ruv_0.9.7.1
[111] rstudioapi_0.11
[112] foreign_0.8-72
[113] git2r_0.27.1
[114] bsseq_1.22.0
[115] gridExtra_2.3
[116] farver_2.0.3
[117] digest_0.6.25
[118] BiocManager_1.30.10
[119] shiny_1.3.2
[120] quadprog_1.5-8
[121] Rcpp_1.0.4.6
[122] siggenes_1.60.0
[123] BiocVersion_3.10.1
[124] later_1.0.0
[125] org.Hs.eg.db_3.8.2
[126] httr_1.4.1
[127] AnnotationDbi_1.46.1
[128] biovizBase_1.32.0
[129] colorspace_1.4-1
[130] rvest_0.3.5
[131] XML_3.98-1.20
[132] fs_1.4.1
[133] splines_3.6.1
[134] statmod_1.4.32
[135] rematch2_2.1.0
[136] multtest_2.40.0
[137] mapproj_1.2.6
[138] jcolors_0.0.4
[139] xtable_1.8-4
[140] jsonlite_1.6.1
[141] scico_1.1.0
[142] R6_2.4.1
[143] Hmisc_4.2-0
[144] pillar_1.4.4
[145] htmltools_0.4.0
[146] mime_0.9
[147] interactiveDisplayBase_1.22.0
[148] beanplot_1.2
[149] codetools_0.2-16
[150] maps_3.3.0
[151] lattice_0.20-41
[152] curl_4.3
[153] BiasedUrn_1.07
[154] gtools_3.8.1
[155] GO.db_3.8.2
[156] openssl_1.4.1
[157] survival_2.44-1.1
[158] rmarkdown_2.1
[159] methylumi_2.30.0
[160] munsell_0.5.0
[161] GenomeInfoDbData_1.2.1
[162] HDF5Array_1.14.4
[163] gtable_0.3.0