-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfigures_5-S7.R
187 lines (177 loc) · 7.98 KB
/
figures_5-S7.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Saiz *et al* (2016)
# Figures 4 and S6 plots
# Load data and apply transformations if not loaded yet
data.ok <- exists('FGF.all')
tables.ok <- exists('FGF.sum')
if (data.ok == FALSE) {
source('Transformations.R')
}
rm(data.ok)
if (tables.ok == FALSE) {
source('tables.R')
}
rm(tables.ok)
# Create object for identity colors
idcols <- c('EPI' = 'red', 'PRE' = 'blue', 'DP' = 'purple', 'DN' = 'gray',
'TE' = 'green', 'ICM' = 'purple')
# Figure 5b
## Scatter plots showing the levels of GATA6 and NANOG in log scale
## in individual ICM cells of embryos collected at the 8-cell stage and
## treated with either FGF4 or PD03 for 30h
## Each dot represents a single ICM cell, color coded for identity
fig5b <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## cultured for 30h (exchange point, 'xp')
filter(TE_ICM != 'TE',
Xpoint == 'xp',
Regime == 'R9'),
aes(x = CH4.ebLogCor, y = CH5.ebLogCor))
## Set up plot aesthetics
fig5b <- fig5b + geom_point(aes(color = Identity.km), size = I(1.5))
fig5b <- fig5b + geom_density2d(color = I('orangered4'), size = 0.5)
fig5b <- fig5b + xlim(-3, 8) + ylim(-3, 8)
fig5b <- fig5b + scale_color_manual(values = idcols)
fig5b <- fig5b + theme_bw() + coord_fixed()
fig5b <- fig5b + labs(color = 'Identity', x = 'log[GATA6]', y = 'log[NANOG]')
## Group by treatment condition
fig5b <- fig5b + facet_grid( ~ Treatment)
## Print plot to the screen
print(fig5b)
# Figure 5d&h
## Scatter plots showing the levels of GATA6 and NANOG in log scale
## in individual ICM cells of embryos collected at the 8-cell stage
## treated with either FGF4 or PD03 for 30h
## and then cultured for a further 18h in regular media
## Each dot represents a single ICM cell, color coded for identity
fig5dh <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## cultured for 30h+18h (end point, 'ep')
filter(TE_ICM != 'TE',
#Treatment != 'FGF42PD',
Xpoint == 'ep',
Regime == 'R9'),
aes(x = CH4.ebLogCor, y = CH5.ebLogCor))
## Set up plot aesthetics
fig5dh <- fig5dh + geom_point(aes(color = Identity.km), size = I(1.5))
fig5dh <- fig5dh + geom_density2d(color = I('orangered4'), size = 0.5)
fig5dh <- fig5dh + xlim(0, 8) + ylim(0, 8)
fig5dh <- fig5dh + scale_color_manual(values = idcols)
fig5dh <- fig5dh + theme_bw() + coord_fixed()
fig5dh <- fig5dh + labs(color = 'Identity', x = 'log[GATA6]', y = 'log[NANOG]')
## Group by treatment condition
fig5dh <- fig5dh + facet_grid( ~ Treatment)
## Print plot to the screen
print(fig5dh)
# Figure 5f
## Bar plot representing the average lineage composition
## for embryos treated in each condition (FGF4 and PD03)
## grouped by culture length (30h and 30+18h)
fig5f <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## in Figure 5b-e
filter(Regime == 'R9',
TE_ICM != 'TE'),
aes(x = Treatment, fill = Identity.km))
## Set up plot aesthetics
fig5f <- fig5f + geom_bar(position = 'fill')
fig5f <- fig5f + scale_fill_manual(values = idcols)
fig5f <- fig5f + facet_wrap( ~ Xpoint)
fig5f <- fig5f + labs(fill = 'Identity', x = 'Treatment', y = '% of ICM')
fig5f <- fig5f + theme_bw()
## Print plot to the screen
print(fig5f)
# ------------------------------------------------------------------------------
# Figure S7b
## Scatter plots showing the levels of GATA6 and NANOG in log scale
## in individual ICM cells of embryos collected at the 8-cell stage and
## treated with either FGF4 or PD03 for 24h
## Each dot represents a single ICM cell, color coded for identity
figS7b <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## cultured for 24h (exchange point, 'xp')
filter(TE_ICM != 'TE',
Treatment != 'FGF42PD',
Regime == 'R8',
Xpoint == 'xp'),
aes(x = CH4.ebLogCor, y = CH5.ebLogCor))
## Set up plot aesthetics
figS7b <- figS7b + geom_point(aes(color = Identity.km), size = I(1.5))
figS7b <- figS7b + geom_density2d(color = I('orangered4'), size = 0.5)
figS7b <- figS7b + xlim(-3, 8) + ylim(-3, 8)
figS7b <- figS7b + scale_color_manual(values = idcols)
figS7b <- figS7b + theme_bw() + coord_fixed()
figS7b <- figS7b + labs(color = 'Identity', x = 'log[GATA6]', y = 'log[NANOG]')
## Group by treatment condition
figS7b <- figS7b + facet_grid( ~ Treatment)
## Print plot to the screen
print(figS7b)
# Figure S7c
## Boxplots showing the total number of cells per embryo
## for embryos in figures 5 and S7 for each treatment condition indicated
## grouped by treatment regime (rows) and experimental point (columns)
figS7c <- ggplot(FGF.all %>%
## Group embryos to extract cell counts
group_by(Embryo_ID,
Regime,
Treatment,
Experimenter,
Xpoint,
Cellcount,
Stage) %>%
summarise() %>%
## Select embryos for Regimes 8 and 9
## treated for 24h or 30h in FGF4 or PD03
## and then released for a further 24h or 18h
## in control media or PD03 (after FGF4 only)
filter(Regime == 'R8' |
Regime == 'R9',
Treatment != 'FGF42PD'),
aes(x = Treatment, y = Cellcount))
figS7c <- figS7c + geom_boxplot(fill = 'gray', color = 'black',
outlier.shape = 1)
figS7c <- figS7c + geom_jitter(size = I(1.2), color = 'black')
figS7c <- figS7c + labs(y = 'Total cell number', x = 'Treatment')
figS7c <- figS7c + coord_fixed(0.03) + theme_bw()
## Group by treatment regime (rows) and experimental point (columns)
figS7c <- figS7c + facet_grid(Regime ~ Xpoint)
## Print plot to screen
print(figS7c)
# Figure S7d
## Bar plot representing the average lineage composition
## for embryos treated in each condition (FGF4 and PD03)
## grouped by culture length (24h and 24+24h)
figS7d <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## in Figure S7a, b
filter(Regime == 'R8',
TE_ICM != 'TE'),
aes(x = Treatment, fill = Identity.km))
## Set up plot aesthetics
figS7d <- figS7d + geom_bar(position = 'fill')
figS7d <- figS7d + scale_fill_manual(values = idcols)
figS7d <- figS7d + facet_wrap( ~ Xpoint)
figS7d <- figS7d + labs(fill = 'Identity', x = 'Treatment', y = '% of ICM')
figS7d <- figS7d + theme_bw()
## Print plot to the screen
print(figS7d)
# Figure S7e
## Bar plots representing ICM composition per embryo
## for embryos treated in each conditions in Figure 5
## grouped by treatment condition
## (think a breakdown of Figure 5f, per embryo)
## Each bar represents the ICM of a single embryo
figS7e <- ggplot(FGF.all %>%
## Select ICM cells from embryos
## in Figure 5
filter(Regime == 'R9',
Xpoint == 'ep',
TE_ICM != 'TE'),
aes(x = Embryo_ID, fill = Identity.km))
## Set up plot aesthetics
figS7e <- figS7e + geom_bar(position = 'fill')
figS7e <- figS7e + scale_fill_manual(values = idcols)
figS7e <- figS7e + facet_grid( ~ Treatment, scales = 'free')
figS7e <- figS7e + labs(fill = 'Identity', x = 'Treatment', y = '% of ICM')
figS7e <- figS7e + theme_bw()
## Print plot to the screen
print(figS7e)