forked from ctlab/ImmGenOpenSource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fig1_genesEtcSuppl.R
116 lines (96 loc) · 4.05 KB
/
Fig1_genesEtcSuppl.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
115
116
source("utils.R")
load("Data/337_es.top12k.Rda")
genes <- c(
"Lyz2", "H2-Aa", "Ccr2", "Cx3cr1",
"Mertk", "Lyve1", "Sall2", "Siglecf", # "Adgre1", "Itgax", "Itgam",
"Zbtb46", "Xcr1", "Sirpa", "Ccr7")
length(genes)
fff <- list()
for(geneNum in seq_along(genes)){
geneExpres <- exprs(es.top12k)[which(fData(es.top12k)$gene == genes[geneNum]), ]
fff[[geneNum]] <- scales::rescale(geneExpres, to = c(-2,2))
}
{
p1 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[1]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[1])) +
theme_bw()
p2 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[2]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[2])) +
theme_bw()
p3 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[3]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[3])) +
theme_bw()
p4 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[4]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[4])) +
theme_bw()
p5 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[5]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[5])) +
theme_bw()
p6 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[6]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[6])) +
theme_bw()
p7 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[7]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[7])) +
theme_bw()
p8 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[8]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[8])) +
theme_bw()
p9 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[9]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[9])) +
theme_bw()
p10 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[10]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[10])) +
theme_bw()
p11 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[11]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[11])) +
theme_bw()
p12 <- pcaPlot(es.top12k, 1, 2) + aes(color=fff[[12]]) +
scale_color_gradientn(colours = gradientColor) +
ggtitle(paste0("Expression of ", genes[12])) +
theme_bw()
}
frs_row <- plot_grid(p1 + theme(legend.position="none"),
p2 + theme(legend.position="none"),
p3 + theme(legend.position="none"),
p4 + theme(legend.position="none"),
labels = c("A", "B", "C", "D"),
hjust = -2,
rel_widths = c(1, 1, 1, 1), nrow = 1)
sec_row <- plot_grid(p5 + theme(legend.position="none"),
p6 + theme(legend.position="none"),
p7 + theme(legend.position="none"),
p8 + theme(legend.position="none"),
labels = c("E", "F", "G", "H"),
hjust = -2,
rel_widths = c(1, 1, 1, 1), nrow = 1)
thd_row <- plot_grid(p9 + theme(legend.position="none"),
p10 + theme(legend.position="none"),
p11 + theme(legend.position="none"),
p12 + theme(legend.position="none"),
labels = c("I", "J", "K", "L"),
hjust = -2,
rel_widths = c(1, 1, 1, 1), nrow = 1)
q <- plot_grid(frs_row, sec_row, thd_row,
rel_widths = c(1, 1, 1),
rel_heights = c(1, 1, 1),
ncol = 1)
###
raw0 <- readr::read_tsv("Data/OSMNP_unnormalized_genes_count_10_3_18.count_table")
raw <- raw0[, which(colnames(raw0) %in% colnames(es.top12k))]
dim(raw)
all.equal(colnames(raw), colnames(es.top12k))
seq_depth <- apply(raw, 2, sum)
pcaPlot(es.top12k, 1, 2) + aes(color=seq_depth) +
scale_color_gradientn(colours = gradientColor) +
theme_bw()