Skip to content

Commit 5b55a6a

Browse files
authored
Merge pull request #50 from shahcompbio/develop
Merge changes to cohort overview with updated patient inclusion list
2 parents b317f9d + 9e835cb commit 5b55a6a

8 files changed

+89
-23
lines changed

110_cohort_overview.Rmd

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,26 +218,31 @@ snv_cna_fusions_tbl <- bind_rows(snv_tbl, cna_tbl, fusions_tbl) %>%
218218
```{r}
219219
# Remove scRNA samples from unidentified sites
220220
db$sequencing_scrna <- db$sequencing_scrna %>%
221+
filter(patient_id %in% included_patients) %>%
221222
filter(tumor_type != "Unknown") %>%
222223
filter(therapy == "pre-Rx")
223224
224225
# Remove H&E samples that are not adjacent or site-matched slides
225226
db$he_slide <- db$he_slide %>%
227+
filter(patient_id %in% included_patients) %>%
226228
filter(is_adjacent == TRUE) %>%
227229
filter(therapy == "pre-Rx")
228230
229231
# Remove mpIF samples that have not been delivered
230232
db$mpif_slide <- db$mpif_slide %>%
233+
filter(patient_id %in% included_patients) %>%
231234
filter(submission_status == "Delivered") %>%
232235
filter(therapy == "pre-Rx")
233236
234237
# Remove normal WGS samples and failed samples
235238
db$sequencing_bulk_dna <- db$sequencing_bulk_dna %>%
239+
filter(patient_id %in% included_patients) %>%
236240
filter(tumor_type %in% c("Primary","Metastasis")) %>%
237241
filter(qc_status == "Pass")
238242
239243
# Remove normal IMPACT samples and remove duplicates
240244
db$sequencing_msk_impact_custom <- db$sequencing_msk_impact_custom %>%
245+
filter(patient_id %in% included_patients) %>%
241246
left_join(samples %>% dplyr::select(impact_dmp_sample_id, tumor_purity)) %>%
242247
filter(impact_gene_panel == "IMPACT") %>%
243248
group_by(impact_dmp_patient_id) %>%
@@ -246,6 +251,7 @@ db$sequencing_msk_impact_custom <- db$sequencing_msk_impact_custom %>%
246251
247252
# Remove Myriad samples not yet delivered
248253
db$sequencing_myriad <- db$sequencing_myriad %>%
254+
filter(patient_id %in% included_patients) %>%
249255
filter(status == "Delivered")
250256
251257
patients <- db$patients %>%
@@ -363,7 +369,7 @@ mat <- data %>%
363369
```{r, fig.width = 8, fig.height = 4.5}
364370
365371
snv_cna_fusions_wide_tbl <- snv_cna_fusions_tbl %>%
366-
filter(patient_id %in% scrna_patients) %>%
372+
filter(patient_id %in% Reduce(union, list(scrna_patients, hne_patients, mpif_patients))) %>%
367373
transform(patient_id = str_remove_all(patient_id, "SPECTRUM-OV-")) %>%
368374
pivot_wider(
369375
id_cols = "hugo_symbol",
@@ -397,7 +403,7 @@ oncoprint_main_mat <- snv_cna_fusions_wide_tbl %>%
397403
398404
# Top annotation
399405
top_df <- db$mutational_signatures %>%
400-
filter(patient_id %in% scrna_patients) %>%
406+
filter(patient_id %in% Reduce(union, list(scrna_patients, hne_patients, mpif_patients))) %>%
401407
left_join(patients, by = 'patient_id') %>%
402408
left_join(gyn_diagnosis, by = 'patient_id') %>%
403409
mutate(patient_id = str_remove_all(patient_id, "SPECTRUM-OV-")) %>%
@@ -479,11 +485,11 @@ rownames(oncoprint_main_ht@matrix)
479485
480486
colnames(oncoprint_main_ht@matrix)
481487
482-
cairo_pdf("figures/110_cohort_overview/110_oncoprint_spectrum_scrna_patients.pdf", width = 13.5, height = 4.5)
488+
cairo_pdf("figures/110_cohort_overview/110_oncoprint_spectrum_scrna_hne_mpif_patients.pdf", width = 13.5, height = 4.5)
483489
print(oncoprint_main_ht)
484490
dev.off()
485491
486-
png("figures/110_cohort_overview/110_oncoprint_spectrum_scrna_patients.png", width = 13.5, height = 4.5, res = 300)
492+
png("figures/110_cohort_overview/110_oncoprint_spectrum_scrna_hne_mpif_patients.png", width = 13.5, height = 4.5, res = 300)
487493
print(oncoprint_main_ht)
488494
dev.off()
489495
@@ -614,7 +620,7 @@ dev.off()
614620
```{r}
615621
616622
data <- inventory %>%
617-
filter(patient_id %in% scrna_patients) %>%
623+
filter(patient_id %in% Reduce(union, list(scrna_patients, hne_patients, mpif_patients))) %>%
618624
filter((therapy == "pre-Rx") | (therapy == "post-Rx" & technique == "bulk_dna")) %>%
619625
get_sample_inventory(., unique = TRUE) %>%
620626
dplyr::left_join(patients, by = 'patient_id') %>%
118 Bytes
Binary file not shown.
14 Bytes
Loading
Binary file not shown.
7 Bytes
Loading

src/global_vars.R

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,34 @@ included_patients <- db$patients %>%
112112

113113
# Define patients included in the study with scRNA data
114114
scrna_patients <- db$sequencing_scrna %>%
115-
filter(patient_id %in% included_patients) %>%
116-
filter(therapy == "pre-Rx") %>%
117-
filter(platform == "10x 3' GE") %>%
115+
filter(patient_id %in% included_patients,
116+
therapy == "pre-Rx",
117+
platform == "10x 3' GE",
118+
qc_status == "Pass") %>%
119+
pull(patient_id) %>%
120+
unique
121+
122+
# Define patients included in the study with mpIF data
123+
mpif_patients <- db$mpif_slide %>%
124+
filter(patient_id %in% included_patients,
125+
therapy == "pre-Rx",
126+
qc_status == "Pass") %>%
127+
pull(patient_id) %>%
128+
unique
129+
130+
# Define patients included in the study with H&E data
131+
hne_patients <- db$he_slide %>%
132+
filter(patient_id %in% included_patients,
133+
patient_id %in% union(scrna_patients, mpif_patients),
134+
therapy == "pre-Rx") %>%
118135
pull(patient_id) %>%
119136
unique
120137

121138
## load mutational signatures ----------------------
122139

123140
signature_tbl <- db$mutational_signatures %>%
124-
mutate(consensus_signature = ordered(consensus_signature, levels = names(clrs$consensus_signature))) %>%
141+
mutate(consensus_signature = ordered(consensus_signature, levels = names(clrs$consensus_signature)),
142+
consensus_signature_short = ordered(consensus_signature_short, levels = names(clrs$consensus_signature_short))) %>%
125143
arrange(patient_id)
126144

127145
## load scRNA meta data -----------------------------
@@ -136,6 +154,13 @@ scrna_meta_tbl <- db$sequencing_scrna %>%
136154
tumor_supersite = str_replace_all(tumor_supersite, "Upper Quadrant", "UQ")) %>%
137155
mutate(tumor_megasite = ifelse(!tumor_supersite %in% c("Adnexa", "Ascites"),
138156
"Other", tumor_supersite)) %>%
157+
mutate(tumor_megasite_adnexa = case_when(
158+
tumor_megasite == "Adnexa" ~ "Adnexa",
159+
tumor_megasite == "Ascites" ~ "Other",
160+
tumor_megasite == "Other" ~ "Other",
161+
tumor_megasite == "Unknown" ~ "Unknown",
162+
TRUE ~ as.character(tumor_megasite)
163+
)) %>%
139164
mutate(tumor_supersite = ordered(tumor_supersite, levels = names(clrs$tumor_supersite))) %>%
140165
mutate(
141166
tumor_supersite_adnexa = case_when(
@@ -147,20 +172,6 @@ scrna_meta_tbl <- db$sequencing_scrna %>%
147172
) %>%
148173
left_join(signature_tbl, by = "patient_id")
149174

150-
## load mpIF meta data -------------------------------
151-
152-
mpif_slide_meta_tbl <- db$mpif_slide %>%
153-
mutate(slide_id = str_replace_all(pici_id, " ", "_"),
154-
sample_id = paste0(patient_id, "_", surgery, str_replace_all(toupper(tumor_subsite), " ", "_"))) %>%
155-
mutate(patient_id_short = str_remove_all(patient_id, "SPECTRUM-OV-"),
156-
tumor_supersite = str_replace_all(tumor_supersite, "Upper Quadrant", "UQ")) %>%
157-
mutate(tumor_megasite = ifelse(!tumor_supersite %in% c("Adnexa"),
158-
"Other", tumor_supersite)) %>%
159-
mutate(tumor_supersite = ordered(tumor_supersite, levels = names(clrs$tumor_supersite))) %>%
160-
filter(patient_id %in% included_patients,
161-
therapy == "pre-Rx") %>%
162-
left_join(signature_tbl, by = "patient_id")
163-
164175
## load H&E meta data -------------------------------
165176

166177
hne_meta_tbl <- db$he_slide %>%
@@ -169,11 +180,60 @@ hne_meta_tbl <- db$he_slide %>%
169180
tumor_supersite = str_replace_all(tumor_supersite, "Upper Quadrant", "UQ")) %>%
170181
mutate(tumor_megasite = ifelse(!tumor_supersite %in% c("Adnexa", "Ascites"),
171182
"Other", tumor_supersite)) %>%
183+
mutate(tumor_megasite_adnexa = case_when(
184+
tumor_megasite == "Adnexa" ~ "Adnexa",
185+
tumor_megasite == "Ascites" ~ "Other",
186+
tumor_megasite == "Other" ~ "Other",
187+
tumor_megasite == "Unknown" ~ "Unknown",
188+
TRUE ~ as.character(tumor_megasite)
189+
)) %>%
172190
mutate(tumor_supersite = ordered(tumor_supersite, levels = names(clrs$tumor_supersite))) %>%
191+
mutate(
192+
tumor_supersite_adnexa = case_when(
193+
tumor_supersite == "Adnexa" & grepl("Adnexa", tumor_subsite) ~ "Adnexa",
194+
tumor_supersite == "Adnexa" & grepl("Ovary", tumor_subsite) ~ "Ovary",
195+
tumor_supersite == "Adnexa" & grepl("Fallopian Tube", tumor_subsite) ~ "Fallopian Tube",
196+
TRUE ~ as.character(tumor_supersite)
197+
)
198+
) %>%
173199
filter(patient_id %in% included_patients,
174200
therapy == "pre-Rx") %>%
175201
left_join(signature_tbl, by = "patient_id")
176202

203+
## load mpIF meta data -------------------------------
204+
205+
mpif_slide_meta_tbl <- db$mpif_slide %>%
206+
# mutate(slide_id = str_replace_all(pici_id, " ", "_"),
207+
mutate(slide_id = paste0(patient_id, "_", surgery, str_replace_all(toupper(tumor_subsite), " ", "_")),
208+
patient_id_short = str_remove_all(patient_id, "SPECTRUM-OV-"),
209+
sample_id_short = str_remove_all(sample_id, "OV-"),
210+
aliquot_id_short = str_remove_all(aliquot_id, "OV-"),
211+
tumor_supersite = str_replace_all(tumor_supersite, "Upper Quadrant", "UQ")) %>%
212+
mutate(tumor_megasite = ifelse(!tumor_supersite %in% c("Adnexa"),
213+
"Other", tumor_supersite)) %>%
214+
mutate(tumor_megasite_adnexa = case_when(
215+
tumor_megasite == "Adnexa" ~ "Adnexa",
216+
tumor_megasite == "Ascites" ~ "Other",
217+
tumor_megasite == "Other" ~ "Other",
218+
tumor_megasite == "Unknown" ~ "Unknown",
219+
TRUE ~ as.character(tumor_megasite)
220+
)) %>%
221+
mutate(tumor_supersite = ordered(tumor_supersite, levels = names(clrs$tumor_supersite))) %>%
222+
mutate(
223+
tumor_supersite_adnexa = case_when(
224+
tumor_supersite == "Adnexa" & grepl("Adnexa", tumor_subsite) ~ "Adnexa",
225+
tumor_supersite == "Adnexa" & grepl("Ovary", tumor_subsite) ~ "Ovary",
226+
tumor_supersite == "Adnexa" & grepl("Fallopian Tube", tumor_subsite) ~ "Fallopian Tube",
227+
TRUE ~ as.character(tumor_supersite)
228+
)
229+
) %>%
230+
filter(patient_id %in% included_patients,
231+
therapy == "pre-Rx",
232+
qc_status == "Pass") %>%
233+
left_join(signature_tbl, by = "patient_id")
234+
235+
mpif_fov_meta_tbl <- db$mpif_fov
236+
177237
## load WGS meta data -------------------------------
178238

179239
bulk_dna_meta_tbl <- db$sequencing_bulk_dna %>%

0 commit comments

Comments
 (0)