-
Notifications
You must be signed in to change notification settings - Fork 42
/
2.1.bam_1M_reads_pct.R.cp.R
115 lines (108 loc) · 11.1 KB
/
2.1.bam_1M_reads_pct.R.cp.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
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
library(ggplot2)
require(cowplot)
# args = commandArgs(T)
data = read.table("all_sample_1M_bin_reads_pct.xls",header = F)
#data = read.table(args[1], header=F)
data$V5 = factor(data$V5,labels = c("IS","Health"))
p1 = ggplot(data[data$V2=="chr1",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr1") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p2 = ggplot(data[data$V2=="chr2",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr2") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p3 = ggplot(data[data$V2=="chr3",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr3") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p4 = ggplot(data[data$V2=="chr4",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr4") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p5 = ggplot(data[data$V2=="chr5",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr5") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p6 = ggplot(data[data$V2=="chr6",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr6") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p7 = ggplot(data[data$V2=="chr7",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr7") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p8 = ggplot(data[data$V2=="chr8",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr8") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p9 = ggplot(data[data$V2=="chr9",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr9") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p10 = ggplot(data[data$V2=="chr10",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr10") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p11 = ggplot(data[data$V2=="chr11",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr11") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p12 = ggplot(data[data$V2=="chr12",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr12") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p13 = ggplot(data[data$V2=="chr13",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr13") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p14 = ggplot(data[data$V2=="chr14",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr14") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p15 = ggplot(data[data$V2=="chr15",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr15") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p16 = ggplot(data[data$V2=="chr16",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr16") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p17 = ggplot(data[data$V2=="chr17",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr17") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p18 = ggplot(data[data$V2=="chr18",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr18") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p19 = ggplot(data[data$V2=="chr19",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr19") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p20 = ggplot(data[data$V2=="chr20",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr20") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p21 = ggplot(data[data$V2=="chr21",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr21") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p22 = ggplot(data[data$V2=="chr22",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chr22") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p23 = ggplot(data[data$V2=="chrX",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chrX") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p24 = ggplot(data[data$V2=="chrY",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chrY") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
p25 = ggplot(data[data$V2=="chrM",], aes(x=V3,y=V4,label=round(V4, digits = 2),group=V5,color=V5))+stat_summary(fun.y="mean",geom = "point") +
xlab("bins") + ylab("mean percentage") +ggtitle("chrM") +theme(plot.title = element_text(hjust = 0.5))+
scale_y_continuous(labels=scales::percent, expand=c(0,0))+expand_limits(x=0)+scale_x_continuous(expand = c(0, 0))+theme(legend.title = element_blank())
ggdraw() +
draw_plot(p1 , 0, 0.8, 0.2, 0.2) +
draw_plot(p2 , 0.2, 0.8, 0.2, 0.2) +
draw_plot(p3 , 0.4, 0.8, 0.2, 0.2) +
draw_plot(p4 , 0.6, 0.8, 0.2, 0.2) +
draw_plot(p5 , 0.8, 0.8, 0.2, 0.2) +
draw_plot(p6 , 0, 0.6, 0.2, 0.2) +
draw_plot(p7 , 0.2, 0.6, 0.2, 0.2) +
draw_plot(p8 , 0.4, 0.6, 0.2, 0.2) +
draw_plot(p9 , 0.6, 0.6, 0.2, 0.2) +
draw_plot(p10, 0.8, 0.6, 0.2, 0.2) +
draw_plot(p11, 0, 0.4, 0.2, 0.2) +
draw_plot(p12, 0.2, 0.4, 0.2, 0.2) +
draw_plot(p13, 0.4, 0.4, 0.2, 0.2) +
draw_plot(p14, 0.6, 0.4, 0.2, 0.2) +
draw_plot(p15, 0.8, 0.4, 0.2, 0.2) +
draw_plot(p16, 0, 0.2, 0.2, 0.2) +
draw_plot(p17, 0.2, 0.2, 0.2, 0.2) +
draw_plot(p18, 0.4, 0.2, 0.2, 0.2) +
draw_plot(p19, 0.6, 0.2, 0.2, 0.2) +
draw_plot(p20, 0.8, 0.2, 0.2, 0.2) +
draw_plot(p21, 0, 0, 0.2, 0.2) +
draw_plot(p22, 0.2, 0, 0.2, 0.2) +
draw_plot(p23, 0.4, 0, 0.2, 0.2) +
draw_plot(p24, 0.6, 0, 0.2, 0.2) +
draw_plot(p25, 0.8, 0, 0.2, 0.2)
ggsave("1M_means.jpg")