-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AJG.Code review #11
Open
agodec
wants to merge
11
commits into
VanAndelInstitute:main
Choose a base branch
from
agodec:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
AJG.Code review #11
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ec9177e
added my name as reviewer
Svad98 ede2246
info about load_all - necessary for code to run
Svad98 2bd2e6a
answer for mutual exclusivity of IDH and TET2
Svad98 65f1094
Finding out who the anomaly is - could be useful later
Svad98 adc7453
what does this chunk show us about GWMe?
Svad98 dfd5a90
need this for chunk to run
Svad98 f0992f5
i'm the reviewer
Svad98 adda471
Merge pull request #6 from Svad98/main
ShantiniqueMiller 10b6c2c
Here we go!
95cf575
Code Review AJG
cc8b5a8
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
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Wish I could have done this!