-
Notifications
You must be signed in to change notification settings - Fork 2
/
FigureS12_expression_quantification.Rmd
79 lines (64 loc) · 2.23 KB
/
FigureS12_expression_quantification.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: "Figure S12 Reporter-ChIP-nexus expression quantification"
author: "Wanqing Shao([email protected]) "
output:
pdf_document:
toc: yes
header-includes:
- \usepackage{fancyhdr}
- \usepackage{lipsum}
- \pagestyle{fancy}
- \fancypagestyle{plain}{\pagestyle{fancy}}
---
# Enviroment setup
``` {r setup, message=FALSE, error=FALSE}
library(GenomicRanges, warn.conflicts=F)
library(magrittr)
library(Rmisc)
library(reshape2)
setwd("/data/analysis_code")
options(knitr.figure_dir =
"FigureS12_expression_quantification")
source("shared_code/knitr_common.r")
source("shared_code/ggplot_common.r")
source("shared_code/granges_common.r")
source("shared_code/metapeak_common.r")
```
# Analysis
```{r, fig.height= 5, fig.width=7}
expression <- read.csv("expression_quantification.csv")
prepare_expression_df <- function(genes){
downstream_exp <- subset(expression, gene %in% genes) %>%
melt(., id.vars = "gene", na.rm = T)
summary <- summarySE(downstream_exp, measurevar="value", groupvars="gene")
summary$gene <- factor(summary$gene, levels = genes)
summary
}
downstream <- c("pepck", "act5c", "pepck-pk", "pepck-dve", "act5c-pk")
tata <- c("pk", "comm2", "dve",
"act5c_up_pk", "act5c_up_comm2", "act5c_up_dve",
"tata_pk", "tata_comm2", "tata_dve")
inr <- c("dve", "act5c_up_dve", "act5c_dve_down", "dve_act5c_inr")
inr_2 <- c("dve", "pk", "scp", "dve-inr-T", "dve-inr-A", "pk-inr-T", "scp-inr-T")
sample_list <- list(downstream = downstream,tata=tata, inr= inr, inr2= inr_2)
expression_df <- lapply(sample_list, prepare_expression_df)
plotting_expression <- function(exp_df){
x <- ggplot(exp_df, aes(x=gene, y=value)) +
geom_bar(stat= "identity", position = "dodge",
fill = "#EBBD77") +
geom_errorbar(aes(ymin=value-se, ymax=value+se),
width=.1, position=position_dodge(.9)) +
ylab("Normalized signal") +
xlab("")+
ggtitle("Expression")+
geom_hline(yintercept = 1, lty = 4) +
theme(axis.text.x = element_text(size=14, angle = 60, hjust = 1))
print(x)
}
nothing <- lapply(expression_df, plotting_expression)
```
# Session Info
This analysis was performed with the following R/Bioconductor session:
```{r}
sessionInfo()
```