Skip to content

Commit 045a2a5

Browse files
final commit
1 parent 64f13d5 commit 045a2a5

File tree

3 files changed

+87
-27
lines changed

3 files changed

+87
-27
lines changed

pipeline/analysis/Numerical_summary.Rmd

+7-13
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@ author: "Michael Geuenich"
44
date: "July 28, 2020"
55
output: html_document
66
params:
7-
basel_type: "../../output/squirrel/astir_assignments/basel_astir_assignments.csv"
8-
basel_state: "../../output/v6/astir_assignments/basel_astir_assignments_state.csv"
7+
basel_type: "../../output/phoenix/astir_assignments/basel_astir_assignments.csv"
98
basel_metadata: "../../data-raw/metadata/basel_PatientMetadata.csv"
109

11-
zurich_type: "../../output/squirrel/astir_assignments/zurich1_astir_assignments.csv"
12-
zurich_state: "../../output/v6/astir_assignments/zurich1_astir_assignments_state.csv"
10+
zurich_type: "../../output/phoenix/astir_assignments/zurich1_astir_assignments.csv"
1311
zurich_metadata: "../../data-raw/metadata/zurich1_PatientMetadata.csv"
1412

15-
schapiro_type: "../../output/squirrel/astir_assignments/schapiro_astir_assignments.csv"
16-
schapiro_state: "../../output/v6/astir_assignments/schapiro_astir_assignments_state.csv"
13+
schapiro_type: "../../output/phoenix/astir_assignments/schapiro_astir_assignments.csv"
1714

18-
wagner_type: "../../output/squirrel/astir_assignments/wagner_astir_assignments.csv"
19-
wagner_state: "../../output/v6/astir_assignments/wagner_astir_assignments_state.csv"
15+
wagner_type: "../../output/phoenix/astir_assignments/wagner_astir_assignments.csv"
2016
wagner_metadata: "../../data-raw/metadata/wagner-clinical-characteristics.csv"
2117

22-
lin_type: "../../output/squirrel/astir_assignments/lin_cycif_astir_assignments.csv"
18+
lin_type: "../../output/phoenix/astir_assignments/lin_cycif_astir_assignments.csv"
2319
---
2420

2521
```{r setup, include=FALSE, message=FALSE}
@@ -41,30 +37,28 @@ basel_types <- read_csv(params$basel_type) %>%
4137
select(X1, cell_type) %>%
4238
mutate(cohort = "basel")
4339
44-
#basel_states <- read_csv(params$basel_state) %>% select(-X1)
4540
basel_metadata <- read_csv(params$basel_metadata)
4641
4742
schapiro_types <- read_csv(params$schapiro_type) %>%
4843
mutate(cell_type = get_celltypes(select(., -X1))) %>%
4944
select(X1, cell_type) %>%
5045
mutate(cohort = "schapiro")
5146
52-
#schapiro_states <- read_csv(params$schapiro_state) %>% select(-X1)
5347
5448
wagner_types <- read_csv(params$wagner_type) %>%
5549
mutate(cell_type = get_celltypes(select(., -X1))) %>%
5650
select(X1, cell_type) %>%
5751
mutate(cohort = "wagner")
5852
59-
#wagner_states <- read_csv(params$wagner_state) %>% select(-X1)
53+
6054
wagner_metadata <- read_csv(params$wagner_metadata)
6155
6256
zurich_types <- read_csv(params$zurich_type) %>%
6357
mutate(cell_type = get_celltypes(select(., -X1))) %>%
6458
select(X1, cell_type) %>%
6559
mutate(cohort = "zurich")
6660
67-
#zurich_states <- read_csv(params$zurich_state) %>% select(-X1)
61+
6862
zurich_metadata <- read_csv(params$zurich_metadata)
6963
7064
lin_types <- read_csv(params$lin_type) %>%

pipeline/analysis/Quantify-uncertainty.R

+79-13
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ devtools::load_all("../taproom/")
77

88

99
# 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")
1212

1313
# Get the maximum probability for each cell
1414
max_prob <- zurich_assignments %>%
@@ -60,7 +60,7 @@ x7.p <- get_p(x_7)
6060
x8.p <- get_p(x_8)
6161

6262
# 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)
6464
Ay16_prob %>%
6565
ggplot(aes(x = core, y = max_prob, fill = core)) +
6666
geom_boxplot() +
@@ -111,7 +111,7 @@ raw_imc$core <- sapply(strsplit(raw_imc$cell, "_"), function(x) x[4])
111111

112112

113113
# 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)
115115

116116
x1_4 <- filter(raw_imc, grepl("Ay16x1|Ay16x2|Ay16x3|Ay16x4", core)) %>%
117117
pull(total_raw_signal)
@@ -136,25 +136,25 @@ raw_imc %>%
136136
geom_boxplot() +
137137
# x1-4
138138
annotate("segment", x = "Ay16x1", xend = "Ay16x4", y = 100, yend = 100) +
139-
140-
# x5
139+
140+
# # x5
141141
annotate("segment", x = 2.5, xend = 2.5, y = 100, yend = 460) +
142-
142+
143143
annotate("segment", x = 2.5, xend = "Ay16x5", y = 250, yend = 250) +
144144
annotate("segment", x = "Ay16x5", xend = "Ay16x5", y = 250, yend = 240) +
145145
annotate("text", x = 3.75, y = 265, label = x5.p, hjust = 0.5) +
146-
147-
# x6
146+
147+
# # x6
148148
annotate("segment", x = 2.5, xend = "Ay16x6", y = 320, yend = 320) +
149149
annotate("segment", x = "Ay16x6", xend = "Ay16x6", y = 320, yend = 310) +
150150
annotate("text", x = 4, y = 335, label = x6.p, hjust = 0.5) +
151-
152-
# x7
151+
152+
# # x7
153153
annotate("segment", x = 2.5, xend = "Ay16x7", y = 390, yend = 390) +
154154
annotate("segment", x = "Ay16x7", xend = "Ay16x7", y = 390, yend = 380) +
155155
annotate("text", x = 4.75, y = 405, label = x7.p, hjust = 0.5) +
156-
157-
# x8
156+
157+
# # x8
158158
annotate("segment", x = 2.5, xend = "Ay16x8", y = 460, yend = 460) +
159159
annotate("segment", x = "Ay16x8", xend = "Ay16x8", y = 460, yend = 450) +
160160
annotate("text", x = 5.25, y = 475, label = x8.p, hjust = 0.5) +
@@ -172,3 +172,69 @@ raw_imc %>%
172172

173173
dev.off()
174174

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()

pipeline/epithelial-overclustering/Epithelial-overclustering-Phenograph.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ output: html_document
66
params:
77
markers: "all_markers"
88
cells: "../../output/squirrel/sces/basel_sce.rds"
9-
cellSubset: "output/squirrel/results/epithelial_overclustering/luminal-0.3.csv"
9+
cellSubset: "../../output/squirrel/results/epithelial_overclustering/luminal-0.3.csv"
1010
markers_list: "../../markers/jackson-2020-markers-v4.yml"
1111
output_results: ""
1212
percent_luminal: ""

0 commit comments

Comments
 (0)