-
Notifications
You must be signed in to change notification settings - Fork 0
/
sup_01_replicates.Rmd
138 lines (92 loc) · 4.32 KB
/
sup_01_replicates.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
title: "Replicates analysis"
output: workflowr::wflow_html
editor_options:
chunk_output_type: console
params:
chromhmm: "./data/bed/E008_15_coreMarks_hg38lift_noblock_fullnames.bed"
---
# Summary
This is the supplementary notebook for replicates analysis
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
library(rtracklayer)
library(tidyverse)
library(effsize)
library(ggpubr)
library(ggplot2)
library(ggrastr)
library(cowplot)
library(dplyr)
source("./code/globals.R")
source("./code/embed_functions.R")
source("./code/heatmap_panels.R")
source("./code/heatmaply_functions.R")
knitr::opts_chunk$set(dev = c('png', 'my_svg'), fig.ext = c("png", "svg"), fig.width = 8, fig.height = 8)
knitr::opts_chunk$set(class.source='fold-show')
court_file <- "./data/bed/Bivalent_Court2017.hg38.bed"
genes_file <- "./data/bed/Kumar_2020/Kumar_2020_genes_hg38_UCSC.bed"
genes_tss <- promoters(import(genes_file), upstream = 2500, downstream = 2500)
court_peaks <- import(court_file)
court_tss <- subsetByOverlaps(genes_tss, court_peaks)
court_genes <- subsetByOverlaps(import(genes_file), court_tss)
```
# Replicates correlation
```{r replicates-corr}
library(corrplot)
bins_table <- "./data/meta/Kumar_2020_master_bins_10kb_table_final_raw.tsv"
bins_df <- read.table(bins_table, sep = "\t", header = T,
colClasses = c("character", "integer", "integer", "factor", "factor", rep("numeric", 112)))
reps <- bins_df[, grepl("rep[1-3]_mean_cov", colnames(bins_df))]
cormat <- cor(reps, method = "pearson")
corrplot(cormat)
```
# Replicates ChromHMM
## H3K4m3
```{r h3k4m3-chromhmm-replicates, message=F, warning=F, fig.width = 13, fig.height = 14}
flist <- list.files(bwdir, pattern = "H3K4m3.*rep[1-3].hg38.scaled.bw", full.names = T)
labels <- gsub(".hg38.scaled.bw", "", basename(flist))
labels <- gsub("_H9", "", labels)
chromhmm <- params$chromhmm
plot_bw_loci_summary_heatmap(flist, chromhmm, labels = labels, remove_top=0.001)
```
## H3K27m3
```{r h3k27m3-chromhmm-replicates, message=F, warning=F, fig.width = 13, fig.height = 14}
flist <- list.files(bwdir, pattern = "H3K27m3.*rep[1-3].hg38.scaled.bw", full.names = T)
labels <- gsub(".hg38.scaled.bw", "", basename(flist))
labels <- gsub("_H9", "", labels)
chromhmm <- params$chromhmm
plot_bw_loci_summary_heatmap(flist, chromhmm, labels = labels, remove_top=0.001)
```
## H2Aub
```{r h2aub-chromhmm-replicates, message=F, warning=F, fig.width = 13, fig.height = 14}
flist <- list.files(bwdir, pattern = "H2Aub.*rep[1-3].hg38.scaled.bw", full.names = T)
labels <- gsub(".hg38.scaled.bw", "", basename(flist))
labels <- gsub("_H9", "", labels)
chromhmm <- params$chromhmm
plot_bw_loci_summary_heatmap(flist, chromhmm, labels = labels, remove_top=0.001)
```
# Replicates at bivalent
## H3K4m3
```{r h3k4m3-bivalent-replicates, message=F, warning=F, fig.width = 8, fig.height = 8}
color_list <- c("#278b8b", "#36bfbf", "#1b6363",
"#76c6c7", "#aed1d1", "#778f8f",
"#f44b34", "#ba3927", "#872517",
"#f5baba", "#b88c8c", "#8c6f6f")
plot_bw_profile(flist, labels = labels, colors = color_list, loci = court_genes, upstream = 5000, downstream = 5000, mode = "stretch") + theme_default(base_size = 12) + theme(legend.position = c(0.80, 0.75)) + labs(x = "Court Bivalent 2017")
```
## H3K27m3
```{r h3k27m3-bivalent-replicates, message=F, warning=F, fig.width = 8, fig.height = 8}
color_list <- c("#278b8b", "#36bfbf", "#1b6363",
"#76c6c7", "#aed1d1", "#778f8f",
"#f44b34", "#ba3927", "#872517",
"#f5baba", "#b88c8c", "#8c6f6f")
plot_bw_profile(flist, labels = labels, colors = color_list, loci = court_genes, upstream = 5000, downstream = 5000, mode = "stretch") + theme_default(base_size = 12) + theme(legend.position = c(0.80, 0.75)) + labs(x = "Court Bivalent 2017")
```
## H2Aub
```{r h2aub-bivalent-replicates, message=F, warning=F, fig.width = 8, fig.height = 8}
color_list <- c("#278b8b", "#36bfbf", "#1b6363",
"#76c6c7", "#aed1d1", "#778f8f",
"#f44b34", "#ba3927", "#872517",
"#f5baba", "#b88c8c", "#8c6f6f")
plot_bw_profile(flist, labels = labels, colors = color_list, loci = court_genes, upstream = 5000, downstream = 5000, mode = "stretch") + theme_default(base_size = 12) + theme(legend.position = c(0.80, 0.75)) + labs(x = "Court Bivalent 2017")
```