From ec9177e48620d31c634e9459e8c54bd59968e402 Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sat, 27 Nov 2021 14:49:25 -0500 Subject: [PATCH 01/10] added my name as reviewer --- vignettes/TET2.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index a79f410..ed40adc 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -1,6 +1,7 @@ --- title: "Code review: TET2 and hypermethylation" author: "Tim Triche" +reviewer: "Svetlana Djirackor" date: "November 22nd, 2021" output: html_document: From ede2246b41fcd131c4f32c1058adee34cead6b91 Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sat, 27 Nov 2021 14:52:57 -0500 Subject: [PATCH 02/10] info about load_all - necessary for code to run --- vignettes/TET2.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index ed40adc..45e7ca2 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -16,7 +16,8 @@ vignette: > knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(devtools) -load_all("./") +load_all("./") +# the load_all("./") is necessary to make the code run (DNAme does not work without it) ``` # Installation From 2bd2e6a5b93d9e0ed16f85bde8a81b8c0de95753 Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sat, 27 Nov 2021 17:03:01 -0500 Subject: [PATCH 03/10] answer for mutual exclusivity of IDH and TET2 --- vignettes/TET2.Rmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index 45e7ca2..ce19304 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -88,6 +88,8 @@ dim(DNAme) Is it the case that TET2, IDH1, and IDH2 mutations are exclusive? +With the exception of GSM604380/patient 316, TET2 and IDH1/2 mutations are exclusive. + ```{r, heatmap, eval=TRUE} # always plot your data From 65f1094bd3c095d9c90d1a1c11e6c83f34c0d784 Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:31:19 -0500 Subject: [PATCH 04/10] Finding out who the anomaly is - could be useful later --- vignettes/TET2.Rmd | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index ce19304..a3e5433 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -87,8 +87,7 @@ dim(DNAme) ### Some contrasts Is it the case that TET2, IDH1, and IDH2 mutations are exclusive? - -With the exception of GSM604380/patient 316, TET2 and IDH1/2 mutations are exclusive. +_With the exception of GSM604380/patient 316, TET2 and IDH1/2 mutations are exclusive._ ```{r, heatmap, eval=TRUE} @@ -100,6 +99,21 @@ Heatmap(mutations, col=c("lightgray","darkred"), name="mutant", column_km=4, ``` +### Healthy curiosity +```{r, The OddBall} +# one patient is the odd-ball here +as_tibble(DNAme$`idh1.idh2:ch1`) -> idh1_idh2 +# since there is ch1 and 2, I compared both and they have the exact same information +# as_tibble(DNAme$`idh1.idh2:ch2`) -> idh1_idh2_next +# idh1_idh2 == idh1_idh2_next - returns TRUE +as_tibble(DNAme$`tet2:ch1`) -> tet +# as_tibble(DNAme$`tet2:ch2`) -> tet_2 +# tet == tet_2 - returns TRUE +colnames(tet) <- c("TET") +colnames(idh1_idh2) <- c("IDH") +compiled <- cbind(tet, idh1_idh2) +View(compiled) # scrolled through and identified the patient/sample number that had the mutations in both TET2 and IDH +``` Do we see genome-wide hypermethylation from TET2 mutations? ```{r, TET2_vs_IDH} From adc74535618a542933605b5cc72a081334184a08 Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:35:18 -0500 Subject: [PATCH 05/10] what does this chunk show us about GWMe? --- vignettes/TET2.Rmd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index a3e5433..5d60d8d 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -114,6 +114,7 @@ colnames(idh1_idh2) <- c("IDH") compiled <- cbind(tet, idh1_idh2) View(compiled) # scrolled through and identified the patient/sample number that had the mutations in both TET2 and IDH ``` + Do we see genome-wide hypermethylation from TET2 mutations? ```{r, TET2_vs_IDH} @@ -169,3 +170,9 @@ fit3 <- eBayes(lmFit(exprs(DNAme)[, as.integer(rownames(design3))], design3)) # 10 probes for TET2:purity ``` + +I'm unsure of how to interpret the code above: +- The annotation/description of the designs are unclear. +- Why would we run the code this way? +- What do the probe numbers mean? +- How can this be translated into assessing genome-wide methylation? From dfd5a90defcc1e9fef02d8eeba0b85287a60a2ca Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:38:51 -0500 Subject: [PATCH 06/10] need this for chunk to run --- vignettes/TET2.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index 5d60d8d..c6a5002 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -101,6 +101,7 @@ Heatmap(mutations, col=c("lightgray","darkred"), name="mutant", column_km=4, ### Healthy curiosity ```{r, The OddBall} +library(tidyverse) # one patient is the odd-ball here as_tibble(DNAme$`idh1.idh2:ch1`) -> idh1_idh2 # since there is ch1 and 2, I compared both and they have the exact same information From f0992f547ca1cda6ac6d418ad2c275d3bbfa954e Mon Sep 17 00:00:00 2001 From: Svad98 <91341854+Svad98@users.noreply.github.com> Date: Sun, 28 Nov 2021 15:43:59 -0500 Subject: [PATCH 07/10] i'm the reviewer --- vignettes/TET2.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index c6a5002..279e6d8 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -1,7 +1,6 @@ --- title: "Code review: TET2 and hypermethylation" author: "Tim Triche" -reviewer: "Svetlana Djirackor" date: "November 22nd, 2021" output: html_document: @@ -19,6 +18,7 @@ library(devtools) load_all("./") # the load_all("./") is necessary to make the code run (DNAme does not work without it) ``` +# Reviewed by Svetlana Djirackor # Installation From 10b6c2c06e79383071f104c8992a3b1194072703 Mon Sep 17 00:00:00 2001 From: Godec Date: Sun, 28 Nov 2021 22:12:14 -0500 Subject: [PATCH 08/10] Here we go! --- vignettes/TET2.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index 279e6d8..7b48d82 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -1,7 +1,7 @@ --- title: "Code review: TET2 and hypermethylation" -author: "Tim Triche" -date: "November 22nd, 2021" +author: "Tim Triche.AJG" +date: "November 29th, 2021" output: html_document: keep_md: true @@ -16,9 +16,9 @@ knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(devtools) load_all("./") -# the load_all("./") is necessary to make the code run (DNAme does not work without it) +# I trust that I need this but could not build this on my own ``` -# Reviewed by Svetlana Djirackor +# Already eviewed by Svetlana Djirackor (THANKS) # Installation From 95cf575c7d722c0addb17342218cc358f76ba749 Mon Sep 17 00:00:00 2001 From: Godec Date: Sun, 28 Nov 2021 22:19:02 -0500 Subject: [PATCH 09/10] Code Review AJG --- vignettes/TET2.Rmd | 48 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/vignettes/TET2.Rmd b/vignettes/TET2.Rmd index 7b48d82..aea2fae 100644 --- a/vignettes/TET2.Rmd +++ b/vignettes/TET2.Rmd @@ -11,31 +11,46 @@ vignette: > \usepackage[utf8]{inputenc} --- -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -knitr::opts_chunk$set(collapse = TRUE, comment = "#>") -library(devtools) -load_all("./") + # I trust that I need this but could not build this on my own -``` # Already eviewed by Svetlana Djirackor (THANKS) # Installation Install the WorldsSimplestCodeReview package, if you haven't. -```{r, loadpkgs, eval = FALSE, message = FALSE} -#install.packages("remotes") -#install.packages("BiocManager") -#BiocManager::install("VanAndelInstitute/WorldsSimplestCodeReview") +```{r message=FALSE, loadpkgs, eval=FALSE} +install.packages("remotes") +install.packages("BiocManager") +library(BiocManager) +if (!require("GEOquery")) { + BiocManager::install("GEOquery") + library(GEOquery) +} +if(!require("limma")) { + BiocManager::install("limma") + library(limma) +} +#Kate told me I needed this and then I started Rstudio again and now it +#seems to work. +BiocManager::install("VanAndelInstitute/WorldsSimplestCodeReview") +library(tidyverse) library(knitr) +knitr::opts_chunk$set(echo = TRUE) +knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +if (!requireNamespace("BiocManager", quietly = TRUE)) + install.packages("BiocManager") + +library(devtools) +load_all("./") ``` To extract just the R code, you can use knitr::knit(input, tangle=TRUE): -```{r, tangle, eval = FALSE, message = FALSE, echo = FALSE} -# knitr::knit("TET2.Rmd", tangle = TRUE) -# [1] "TET2.R" +```{r, tangle, eval = FALSE, message = FALSE, echo = TRUE} +knitr::knit("TET2.Rmd", tangle = TRUE) +"TET2.R" +#when I run this chunk nothing appears to happen. ``` # Introduction @@ -79,8 +94,9 @@ if (FALSE) { # this takes about 5 minutes: # how many probes, how many patients? dim(DNAme) -# Features Samples -# 25626 394 +#I get the same answer as what the vignette has +#It made something. A large data set of a format that I don't understand +view(DNAme) ``` @@ -92,6 +108,8 @@ _With the exception of GSM604380/patient 316, TET2 and IDH1/2 mutations are excl ```{r, heatmap, eval=TRUE} # always plot your data +install.packages("nat") +install.packages("ComplexHeatmap") library(ComplexHeatmap) mutations <- t(as.matrix(pData(DNAme)[, c("TET2", "IDH")])) Heatmap(mutations, col=c("lightgray","darkred"), name="mutant", column_km=4, From cc8b5a86266fdb5215c977cc1ef3a6bce3b7e130 Mon Sep 17 00:00:00 2001 From: Godec Date: Sun, 28 Nov 2021 22:51:20 -0500 Subject: [PATCH 10/10] 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 --- vignettes/TET2.R | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 vignettes/TET2.R diff --git a/vignettes/TET2.R b/vignettes/TET2.R new file mode 100644 index 0000000..1161b06 --- /dev/null +++ b/vignettes/TET2.R @@ -0,0 +1,141 @@ +## ----message=FALSE, loadpkgs, eval=FALSE----------------------------------------------------------------- +#> install.packages("remotes") +#> install.packages("BiocManager") +#> library(BiocManager) +#> if (!require("GEOquery")) { +#> BiocManager::install("GEOquery") +#> library(GEOquery) +#> } +#> if(!require("limma")) { +#> BiocManager::install("limma") +#> library(limma) +#> } +#> #Kate told me I needed this and then I started Rstudio again and now it +#> #seems to work. +#> BiocManager::install("VanAndelInstitute/WorldsSimplestCodeReview") +#> library(tidyverse) +#> library(knitr) +#> knitr::opts_chunk$set(echo = TRUE) +#> knitr::opts_chunk$set(collapse = TRUE, comment = "#>") +#> if (!requireNamespace("BiocManager", quietly = TRUE)) +#> install.packages("BiocManager") +#> +#> library(devtools) +#> load_all("./") + + +## ---- tangle, eval = FALSE, message = FALSE, echo = TRUE------------------------------------------------- +#> knitr::knit("TET2.Rmd", tangle = TRUE) +#> [1] "TET2.R" + + +## ---- fetchGEO------------------------------------------------------------------------------------------- + +library(limma) +library(GEOquery) +if (!exists("DNAme")) data(DNAme) + +if (FALSE) { # this takes about 5 minutes: + + # needed to fetch data + library(GEOquery) + MSK_HOVON <- getGEO("GSE24505") + + # skip the expression data: + platform <- sapply(MSK_HOVON, annotation) + methylation <- which(platform == "GPL6604") + DNAme <- MSK_HOVON[[methylation]] # GPL6604, HG17_HELP_PROMOTER + DNAme$male <-ifelse(DNAme$characteristics_ch1=="sex (male.1_female.2): 1",1,0) + DNAme$TET2 <- ifelse(DNAme$characteristics_ch1.7 == "tet2: WT", 0, 1) + DNAme$IDH <- ifelse(DNAme$characteristics_ch1.8 == "idh1.idh2: WT", 0, 1) + DNAme$purity <- as.integer(DNAme$"bm_%blasts:ch1") / 100 + save(DNAme, file="../data/DNAme.rda") + +} + +# how many probes, how many patients? +dim(DNAme) +# Features Samples +# 25626 394 + + + +## ---- heatmap, eval=TRUE--------------------------------------------------------------------------------- + +# always plot your data +library(ComplexHeatmap) +mutations <- t(as.matrix(pData(DNAme)[, c("TET2", "IDH")])) +Heatmap(mutations, col=c("lightgray","darkred"), name="mutant", column_km=4, + column_names_gp = gpar(fontsize = 7)) + + + +## ---- The OddBall---------------------------------------------------------------------------------------- +library(tidyverse) +# one patient is the odd-ball here +as_tibble(DNAme$`idh1.idh2:ch1`) -> idh1_idh2 +# since there is ch1 and 2, I compared both and they have the exact same information +# as_tibble(DNAme$`idh1.idh2:ch2`) -> idh1_idh2_next +# idh1_idh2 == idh1_idh2_next - returns TRUE +as_tibble(DNAme$`tet2:ch1`) -> tet +# as_tibble(DNAme$`tet2:ch2`) -> tet_2 +# tet == tet_2 - returns TRUE +colnames(tet) <- c("TET") +colnames(idh1_idh2) <- c("IDH") +compiled <- cbind(tet, idh1_idh2) +View(compiled) # scrolled through and identified the patient/sample number that had the mutations in both TET2 and IDH + + +## ---- TET2_vs_IDH---------------------------------------------------------------------------------------- + +# model TET2 and IDH1/2 mutant related hypermethylation +# note: there are plenty of confounders (pb%, bm%, wbc) that could be included +library(limma) + +# simplest design +design1 <- with(pData(DNAme), model.matrix( ~ IDH + TET2 )) +fit1 <- eBayes(lmFit(exprs(DNAme), design1)) +(IDH_diffmeth_probes_fit1 <- nrow(topTable(fit1, + coef=grep("IDH", colnames(design1)), + p.value=0.05, # change if you like + number=Inf))) +# 6513 probes for IDH + +(TET_diffmeth_probes_fit1 <- nrow(topTable(fit1, + coef=grep("TET2", colnames(design1)), + p.value=0.05, # change if you like + number=Inf))) +# 6 probes for TET2 + +# control for sex +design2 <- with(pData(DNAme), model.matrix( ~ IDH + TET2 + male )) +fit2 <- eBayes(lmFit(exprs(DNAme), design2)) +(IDH_diffmeth_probes_fit2 <- nrow(topTable(fit2, + coef=grep("IDH", colnames(design2)), + p.value=0.05, # change if you like + number=Inf))) +# 6651 probes for IDH + +(TET2_diffmeth_probes_fit2 <- nrow(topTable(fit2, + coef=grep("TET", colnames(design2)), + p.value=0.05, # change if you like + number=Inf))) +# 7 probes for TET2 + +# control for blast count +design3 <- with(pData(DNAme), model.matrix( ~ IDH:purity + TET2:purity)) +fit3 <- eBayes(lmFit(exprs(DNAme)[, as.integer(rownames(design3))], design3)) + +(IDH_diffmeth_probes_fit3 <- nrow(topTable(fit3, + coef=grep("IDH", colnames(design3)), + p.value=0.05, # change if you like + number=Inf))) +# 7450 probes for IDH:purity + +(TET2_diffmeth_probes_fit3 <- nrow(topTable(fit3, + coef=grep("TET", colnames(design3)), + p.value=0.05, # change if you like + number=Inf))) +# 10 probes for TET2:purity + +