Created
April 22, 2021 14:11
-
-
Save markziemann/bd7803c619f7898473b187d55db2f867 to your computer and use it in GitHub Desktop.
here is an Rmd script for performing integrative analysis of proteomic and methylation (array) analysis
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
--- | |
title: "Macsue proteomic/methylation mitch analysis" | |
author: "Mark Ziemann" | |
date: "`r Sys.Date()`" | |
output: | |
html_document: | |
toc: true | |
theme: cosmo | |
--- | |
# Intro | |
Load library and input data. | |
```{r,begin} | |
library("mitch") | |
prot <- read.table("GeneSmart group analyses signif Prot PRE z-score.csv",sep=",", | |
header=TRUE,stringsAsFactors = FALSE) | |
colnames(prot)[1] <- "gene" | |
head(prot) | |
str(prot) | |
meth <- read.table("signif results z-score with gene names.csv",sep=",",header=TRUE,stringsAsFactors = FALSE) | |
dim(meth) | |
methg <- meth$genes | |
methg_spl <- strsplit(methg,";") | |
meth <- meth[which(lapply(methg_spl,length)>0),] | |
head(meth) | |
dim(meth) | |
x <- apply(meth,1,function(x) { | |
GENES <- as.character(x[length(x)]) | |
GENES <- unlist(strsplit(GENES,";")) | |
z <- lapply(GENES,function(G) { | |
y <- x[1:(length(x)-1)] | |
y$Gene <- G | |
y | |
}) | |
do.call(rbind,z) | |
}) | |
meth_fix <- do.call(rbind,x) | |
meth_fix2 <- as.data.frame(apply(meth_fix[,2:7],2,as.numeric)) | |
meth_fix2$gene <- unlist(meth_fix[,"Gene"]) | |
head(meth_fix2) | |
dim(meth_fix2) | |
``` | |
Now import with mitch. | |
```{r,import} | |
prot <- prot[,c("gene","t")] | |
dim(prot) | |
meth <- meth_fix2[,c("gene","t")] | |
meth <- aggregate(. ~ gene, meth, sum) | |
dim(meth) | |
l <- list("prot"=prot,"meth"=meth) | |
m <- mitch_import(x = l,geneIDcol = "gene",DEtype = "limma") | |
``` | |
# Fetch gene sets | |
```{r,reactome} | |
download.file("https://reactome.org/download/current/ReactomePathways.gmt.zip", destfile="ReactomePathways.gmt.zip") | |
unzip("ReactomePathways.gmt.zip") | |
genesets <- gmt_import("ReactomePathways.gmt") | |
``` | |
## Calculate enrichment | |
```{r,enrich} | |
res <- mitch_calc(x=m,genesets = genesets ,priority = "effect",minsetsize = 5) | |
head(res$enrichment_result,50) | |
mitch_report(res = res, outfile = "myreport.html") | |
``` | |
## Session information | |
For reproducibility | |
```{r,session} | |
sessionInfo() | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment