-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtogether_gw.R
executable file
·31 lines (24 loc) · 978 Bytes
/
together_gw.R
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
together_gw <- function(df_end, df_exo, tss = NULL) {
df_end$type <- rep('C', nrow(df_end))
df_exo$type <- rep('G', nrow(df_exo))
colnames(df_end) <- c('Position', 'Percentages', 'Legend')
colnames(df_exo) <- c('Position', 'Percentages', 'Legend')
df_merge <- rbind(df_end, df_exo)
name_x <- "Reference sequence (pb)"
if ( !is.null(tss)) {
name_x <- "Distance to TSS (bp)"
df_merge$Position <- df_merge$Position - as.integer(tss)
}
plot <- ggplot(data = df_merge, aes(x = Position, y = Percentages, group = Legend, colour = Legend)) +
geom_line(size=1.25) +
geom_point(colour = "black", size = 1) +
ylim(0, 100) +
ylab("Average signal (%)") +
xlab(name_x) +
theme(plot.title = element_text(size=17)) +
ggtitle("Overlap") +
scale_colour_manual(values = c('black', 'red'),
labels = c('CpG methylation (%)', '1 - GpC methylation (%)'))
# theme(legend.position="none")
plot
}