@@ -112,16 +112,34 @@ included_patients <- db$patients %>%
112112
113113# Define patients included in the study with scRNA data
114114scrna_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
123140signature_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
166177hne_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
179239bulk_dna_meta_tbl <- db $ sequencing_bulk_dna %> %
0 commit comments