@@ -7,8 +7,8 @@ devtools::load_all("../taproom/")
7
7
8
8
9
9
# Read in data
10
- zurich <- readRDS(" output/cardinal /sces/zurich1_sce.rds" )
11
- zurich_assignments <- read_csv(" output/squirrel /astir_assignments/zurich1_astir_assignments.csv" )
10
+ zurich <- readRDS(" output/phoenix /sces/zurich1_sce.rds" )
11
+ zurich_assignments <- read_csv(" output/phoenix /astir_assignments/zurich1_astir_assignments.csv" )
12
12
13
13
# Get the maximum probability for each cell
14
14
max_prob <- zurich_assignments %> %
@@ -60,7 +60,7 @@ x7.p <- get_p(x_7)
60
60
x8.p <- get_p(x_8 )
61
61
62
62
# Plot probability
63
- pdf(" output/cardinal /figures/Staining_Astir_probability_Ay16.pdf" , width = 7 , height = 5.2 )
63
+ pdf(" output/phoenix /figures/Staining_Astir_probability_Ay16.pdf" , width = 7 , height = 5.2 )
64
64
Ay16_prob %> %
65
65
ggplot(aes(x = core , y = max_prob , fill = core )) +
66
66
geom_boxplot() +
@@ -111,7 +111,7 @@ raw_imc$core <- sapply(strsplit(raw_imc$cell, "_"), function(x) x[4])
111
111
112
112
113
113
# Plot raw imc values
114
- pdf(" output/cardinal /figures/Staining_raw_signal_Ay16.pdf" , width = 7 , height = 5.2 )
114
+ pdf(" output/phoenix /figures/Staining_raw_signal_Ay16.pdf" , width = 7 , height = 5.2 )
115
115
116
116
x1_4 <- filter(raw_imc , grepl(" Ay16x1|Ay16x2|Ay16x3|Ay16x4" , core )) %> %
117
117
pull(total_raw_signal )
@@ -136,25 +136,25 @@ raw_imc %>%
136
136
geom_boxplot() +
137
137
# x1-4
138
138
annotate(" segment" , x = " Ay16x1" , xend = " Ay16x4" , y = 100 , yend = 100 ) +
139
-
140
- # x5
139
+
140
+ # # x5
141
141
annotate(" segment" , x = 2.5 , xend = 2.5 , y = 100 , yend = 460 ) +
142
-
142
+
143
143
annotate(" segment" , x = 2.5 , xend = " Ay16x5" , y = 250 , yend = 250 ) +
144
144
annotate(" segment" , x = " Ay16x5" , xend = " Ay16x5" , y = 250 , yend = 240 ) +
145
145
annotate(" text" , x = 3.75 , y = 265 , label = x5.p , hjust = 0.5 ) +
146
-
147
- # x6
146
+
147
+ # # x6
148
148
annotate(" segment" , x = 2.5 , xend = " Ay16x6" , y = 320 , yend = 320 ) +
149
149
annotate(" segment" , x = " Ay16x6" , xend = " Ay16x6" , y = 320 , yend = 310 ) +
150
150
annotate(" text" , x = 4 , y = 335 , label = x6.p , hjust = 0.5 ) +
151
-
152
- # x7
151
+
152
+ # # x7
153
153
annotate(" segment" , x = 2.5 , xend = " Ay16x7" , y = 390 , yend = 390 ) +
154
154
annotate(" segment" , x = " Ay16x7" , xend = " Ay16x7" , y = 390 , yend = 380 ) +
155
155
annotate(" text" , x = 4.75 , y = 405 , label = x7.p , hjust = 0.5 ) +
156
-
157
- # x8
156
+
157
+ # # x8
158
158
annotate(" segment" , x = 2.5 , xend = " Ay16x8" , y = 460 , yend = 460 ) +
159
159
annotate(" segment" , x = " Ay16x8" , xend = " Ay16x8" , y = 460 , yend = 450 ) +
160
160
annotate(" text" , x = 5.25 , y = 475 , label = x8.p , hjust = 0.5 ) +
@@ -172,3 +172,69 @@ raw_imc %>%
172
172
173
173
dev.off()
174
174
175
+
176
+
177
+
178
+ # ## Within patient comparison
179
+ Ay <- zurich [,grepl(" Ay16x1|Ay16x2|Ay15x7|Ay15x8" , colnames(zurich ))]
180
+
181
+ raw_imc <- assays(Ay )$ raw_imc %> %
182
+ t() %> %
183
+ as.data.frame() %> %
184
+ rownames_to_column(" cell" )
185
+
186
+ raw_imc $ total_raw_signal <- select(raw_imc , - cell ) %> % rowSums()
187
+ raw_imc $ core <- sapply(strsplit(raw_imc $ cell , " _" ), function (x ) x [4 ])
188
+
189
+
190
+ pdf(" output/phoenix/figures/Staining_Within_patient_comparison.pdf" , heigh = 5.2 , width = 4 )
191
+ raw_imc %> %
192
+ ggplot(aes(x = core , y = total_raw_signal , fill = core )) +
193
+ geom_boxplot() +
194
+ stat_compare_means(comparisons = list (c(" Ay15x7" , " Ay15x8" ),
195
+ c(" Ay15x7" , " Ay16x1" ),
196
+ c(" Ay15x7" , " Ay16x2" ),
197
+ c(" Ay15x8" , " Ay16x1" ),
198
+ c(" Ay15x8" , " Ay16x2" ),
199
+ c(" Ay16x1" , " Ay16x2" )),
200
+ method.args = list (alternative = " greater" ),
201
+ tip.length = 0 ) +
202
+ labs(x = " Sample" , y = " Total raw signal" ) +
203
+ scale_fill_brewer(palette = " Blues" ) +
204
+ astir_paper_theme() +
205
+ theme(legend.position = " None" ,
206
+ axis.text = element_text(size = 16 ),
207
+ axis.title = element_text(size = 20 ),
208
+ axis.text.x = element_text(angle = 45 , hjust = 1 ))
209
+ dev.off()
210
+
211
+
212
+ # Get the probabilites associated with cells on Ay16
213
+ Ay16_prob <- max_prob_df [grepl(" Ay16x1|Ay16x2|Ay15x7|Ay15x8" , max_prob_df $ cell ),]
214
+ names <- Ay16_prob %> %
215
+ pull(cell )
216
+
217
+ Ay16_prob $ core <- sapply(strsplit(names , " _" ), function (x ) x [4 ])
218
+
219
+ pdf(" output/phoenix/figures/Astir_max_prob_within_patient_comparison.pdf" , width = 4 , height = 5.2 )
220
+ Ay16_prob %> %
221
+ ggplot(aes(x = core , y = max_prob , fill = core )) +
222
+ geom_boxplot() +
223
+ stat_compare_means(comparisons = list (c(" Ay15x7" , " Ay15x8" ),
224
+ c(" Ay15x7" , " Ay16x1" ),
225
+ c(" Ay15x7" , " Ay16x2" ),
226
+ c(" Ay15x8" , " Ay16x1" ),
227
+ c(" Ay15x8" , " Ay16x2" ),
228
+ c(" Ay16x1" , " Ay16x2" )),
229
+ method.args = list (alternative = " greater" ),
230
+ label.y = c(0.1 , 0.17 , 0.24 , 0.31 , 0.38 , 0.45 ),
231
+ tip.length = 0 ) +
232
+ ylim(0 ,1 ) +
233
+ labs(x = " Sample" , y = " Maximum probability" ) +
234
+ scale_fill_brewer(palette = " Blues" ) +
235
+ astir_paper_theme() +
236
+ theme(legend.position = " None" ,
237
+ axis.text = element_text(size = 16 ),
238
+ axis.title = element_text(size = 20 ),
239
+ axis.text.x = element_text(angle = 45 , hjust = 1 ))
240
+ dev.off()
0 commit comments