Last updated: 2020-08-19
Checks: 7 0
Knit directory: jesslyn_ovca/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20200713) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 729ebf4. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.DS_Store
Ignored: code/.DS_Store
Ignored: data/.DS_Store
Ignored: data/HTAPP/
Ignored: data/Izar_2020/
Ignored: data/gene_lists/.DS_Store
Ignored: data/gene_lists/extra/.DS_Store
Ignored: jesslyn_plots/
Ignored: mike_plots/
Ignored: old/.DS_Store
Ignored: old/edited/.DS_Store
Ignored: renv/.DS_Store
Ignored: renv/library/
Ignored: renv/python/
Ignored: renv/staging/
Ignored: vignettes/
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/03.0_Izar2020_PDX_ExploratoryAnalysis.Rmd) and HTML (docs/03.0_Izar2020_PDX_ExploratoryAnalysis.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| html | 92568b8 | jgoh2 | 2020-08-17 | Build site. |
| Rmd | d60aeff | jgoh2 | 2020-08-17 | More DE Analysis of other hallmarks |
| html | 80345fe | jgoh2 | 2020-08-15 | Build site. |
| html | 789982d | jgoh2 | 2020-08-14 | Build site. |
| html | e05c328 | jgoh2 | 2020-08-12 | Build site. |
| html | 84edf85 | jgoh2 | 2020-08-12 | Build site. |
| Rmd | d504c59 | jgoh2 | 2020-08-12 | workflowr::wflow_publish(files = files) |
| html | a3ddf54 | jgoh2 | 2020-08-07 | Build site. |
| Rmd | 3e3db67 | jgoh2 | 2020-08-07 | workflowr::wflow_publish(files = files) |
| html | d801a7a | jgoh2 | 2020-08-04 | Build site. |
| Rmd | 6d23590 | jgoh2 | 2020-08-04 | workflowr::wflow_publish(files = files) |
| html | 26f64a3 | jgoh2 | 2020-08-03 | Build site. |
| Rmd | eaa900e | jgoh2 | 2020-08-03 | workflowr::wflow_publish(files = files) |
| html | 2dc1bee | jgoh2 | 2020-07-31 | Build site. |
| Rmd | 284aad4 | jgoh2 | 2020-07-31 | workflowr::wflow_publish(files = files) |
| Rmd | c8bb9fc | jgoh2 | 2020-07-30 | PDX Exploratory + DE + Cell Cycle Analyses |
| html | c8bb9fc | jgoh2 | 2020-07-30 | PDX Exploratory + DE + Cell Cycle Analyses |
This is the third part of our 5-part analysis of the Izar 2020 PDX (Cohort 3) data.
# Load packages
source(here::here('packages.R'))
#Read in PDX RDS object
PDX_All = readRDS("data/Izar_2020/test/jesslyn_PDX_All_processed.RDS")
PDX_DF20 = readRDS("data/Izar_2020/test/jesslyn_PDX_DF20_processed.RDS")
PDX_DF101 = readRDS("data/Izar_2020/test/jesslyn_PDX_DF101_processed.RDS")
PDX_DF68 = readRDS("data/Izar_2020/test/jesslyn_PDX_DF68_processed.RDS")
#Read in hallmarks of interest
hallmark_names = read_lines("data/gene_lists/hallmarks.txt")
hallmark.list <- vector(mode = "list", length = length(hallmark_names))
names(hallmark.list) <- hallmark_names
for(hm in hallmark_names){
if(file.exists(glue("data/gene_lists/hallmarks/{hm}_updated.txt"))){
file <- read_lines(glue("data/gene_lists/hallmarks/{hm}_updated.txt"), skip = 1)
hallmark.list[[hm]] <- file
}
else{
file <- read_lines(glue("data/gene_lists/extra/{hm}.txt"), skip =2)
hallmark.list[[hm]] <- file
}
}
#center module and cell cycle scores and reassign to the metadata of each Seurat object
hm.names <- names(PDX_All@meta.data)[9:56]
for(i in hm.names){
DF20.hm.centered <- scale(PDX_DF20[[i]], center = TRUE, scale = FALSE)
PDX_DF20 <- AddMetaData(PDX_DF20, DF20.hm.centered, col.name = glue("{i}.centered"))
DF101.hm.centered <- scale(PDX_DF101[[i]], center = TRUE, scale = FALSE)
PDX_DF101 <- AddMetaData(PDX_DF101, DF101.hm.centered, col.name = glue("{i}.centered"))
DF68.hm.centered <- scale(PDX_DF68[[i]], center = TRUE, scale = FALSE)
PDX_DF68 <- AddMetaData(PDX_DF68, DF68.hm.centered, col.name = glue("{i}.centered"))
}
#number of cells in each treatment level in each model
numCellsPerTreatmentPerModel = table(PDX_All$treatment.status, PDX_All$model_ID)
numCellsPerTreatmentPerModel %>%
as.data.frame() %>%
dplyr::rename(treatmentStatus = Var1, model = Var2, numCells = Freq) %>%
ggplot(aes(x=model, fill=treatmentStatus, y=numCells)) +
geom_bar(stat="identity", position="fill") + labs(fill = "treatmentStatus", x = "model", y = "Percent of cells") +
theme_bw() +
geom_text(aes(label = glue("{numCells} Cells")), position = "fill", hjust = 0.5, vjust = 2, size = 3, color = "white") +
labs(title = "Percent of Malignant Cells Per Treatment Per Model") +
scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07")) +
scale_y_continuous(labels = scales::percent)

The summary metrics of each model shows us how little cells we have in each sample, and in each treatment condition. We therefore have to keep in mind that the results we get from this small sample of cells may not be representative of the true population.
We are interested in finding out how cells cluster together. This helps us qualitatively understand what may be driving their differential expression (if any). We are specifically interested seeing if cells cluster due to these metadata identities: 1. Intermodel heterogeneity: Do separate by model? 2. Intramodel heterogeneity: a. Do cells separate by treatment status? b. Do cells separate by cell cycle phase? c. Do cells separate due to nFeature and nCount? d. Do cells separate by OXPHOS or UPR hallmark scores?
1) BY MODEL
UMAPPlot(PDX_All, group.by = "model_ID") +
labs(title = "PDX UMAP by Model", subtitle = paste(nrow(PDX_All@meta.data), "Malignant Cells")) +
coord_fixed() +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))

2) BY TREATMENT STATUS WITHIN EACH MODEL
DF20.byt <- UMAPPlot(PDX_DF20, group.by = "treatment.status", pt.size = 0.5) + labs(title = "DF20 UMAP by Treatment", subtitle = paste(nrow(PDX_DF20@meta.data), "Malignant Cells")) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF101.byt <- UMAPPlot(PDX_DF101, group.by = "treatment.status", pt.size = 0.5) + labs(title = "DF101 UMAP by Treatment", subtitle = paste(nrow(PDX_DF101@meta.data), "Malignant Cells"))+
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF68.byt <- UMAPPlot(PDX_DF68, group.by = "treatment.status", pt.size = 0.5) + labs(title = "DF68 UMAP by Treatment", subtitle = paste(nrow(PDX_DF68@meta.data), "Malignant Cells"))+
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF20.byt + DF101.byt + DF68.byt + plot_layout(guides = "collect")

DF20.pca.byt <- PCAPlot(PDX_DF20, group.by = "treatment.status", pt.size = 0.5) + labs(title = "DF20 PCA by Treatment", subtitle = paste(nrow(PDX_DF20@meta.data), "Malignant Cells")) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF101.pca.byt <- PCAPlot(PDX_DF101, group.by ="treatment.status", pt.size = 0.5) + labs(title = "DF101 PCA by Treatment", subtitle = paste(nrow(PDX_DF101@meta.data), "Malignant Cells")) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF68.pca.byt <- PCAPlot(PDX_DF68, group.by = "treatment.status", pt.size = 0.5) + labs(title = "DF68 PCA by Treatment", subtitle = paste(nrow(PDX_DF68@meta.data), "Malignant Cells")) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
DF20.pca.byt + DF101.pca.byt + DF68.pca.byt + plot_layout(guides = "collect")

3) BY UPR AND OXPHOS GENESET SCORE
hms.centered <- c("UNUPDATED.OXPHOS37.centered", "UNUPDATED.UPR38.centered")
#UMAP
PDX.names <- c("DF20", "DF101", "DF68")
PDXs <- c(PDX_DF20, PDX_DF101, PDX_DF68)
UMAP.plots <- vector("list", length(PDXs))
names(UMAP.plots) <- PDX.names
for (i in 1:length(PDXs)){
obj <- PDX.names[[i]]
numCells = nrow(PDXs[[i]]@meta.data)
umap <- UMAPPlot(PDXs[[i]], group.by = "treatment.status") +
labs(title = glue("{obj} UMAP by Treatment"), subtitle = glue("{numCells} Malignant Cells"))+
theme(plot.subtitle = element_text(size = 10)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
p <- FeaturePlot(PDXs[[i]], features = hms.centered, combine = FALSE)
p[[1]] <- p[[1]] + labs(title = glue("{obj} UMAP by Oxphos Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "HALLMARK_OXIDATIVE_PHOSPHORYLATION")
p[[2]] <- p[[2]] + labs(title = glue("{obj} UMAP by UPR Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "HALLMARK_UNFOLDED_PROTEIN_RESPONSE")
UMAP.plots[[obj]] <- umap + p[[1]] + p[[2]]
}
UMAP.plots[["DF20"]]

UMAP.plots[["DF101"]]

UMAP.plots[["DF68"]]

4) BY CELL CYCLE PHASE AND BY nFEATURE/ nCOUNT
#UMAP -------------------------
ccUMAP.plots <- vector("list", length = 3)
names(ccUMAP.plots) <- c("DF20", "DF101", "DF68")
for(i in 1:length(PDXs)){
obj = PDXs[[i]]
name = PDX.names[[i]]
numCells = nrow(obj@meta.data)
obj$Phase <- factor(obj$Phase, levels = c("G1", "S", "G2M"))
byt <- UMAPPlot(obj, group.by = "treatment.status", pt.size = 0.5) +
labs(title = glue("{name} UMAP by treatment"), subtitle = glue("{numCells} Malignant Cells")) +
theme(plot.title = element_text(hjust = 0.5, size = 10)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
bycc <- UMAPPlot(obj, group.by = "Phase", pt.size = 0.5) +
labs(title = glue("{name} UMAP by CC Phase"), subtitle = glue("{numCells} Malignant Cells")) +
theme(plot.title = element_text(hjust = 0.5, size = 10)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
byscore <- FeaturePlot(obj, features = c("S.Score.centered", "G2M.Score.centered"), pt.size = 0.5, combine = FALSE)
byscore[[1]] <- byscore[[1]] + labs(title = glue("{name} UMAP by S Score"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
byscore[[2]] <- byscore[[2]] + labs(title = glue("{name} UMAP by G2M Score"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
ccUMAP.plots[[i]] <- byt + bycc + byscore[[1]] + byscore[[2]]
}
ccUMAP.plots[["DF20"]]

ccUMAP.plots[["DF101"]]

ccUMAP.plots[["DF68"]]

#PCA -------------------- (PCA separates cell by cell cycle really well)
ccPCA.plots <- vector("list", length = 3)
names(ccPCA.plots) <- c("DF20", "DF101", "DF68")
for(i in 1:length(PDXs)){
obj = PDXs[[i]]
name = PDX.names[[i]]
numCells = nrow(obj@meta.data)
obj$Phase <- factor(obj$Phase, levels = c("G1", "S", "G2M"))
byt <- PCAPlot(obj, group.by = "treatment.status", pt.size = 0.5) +
labs(title = glue("{name} PCA by treatment"), subtitle = glue("{numCells} Malignant Cell")) +
theme(plot.title = element_text(hjust = 0.5, size = 10)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
bycc <- PCAPlot(obj, group.by = "Phase", pt.size = 0.5) +
labs(title = glue("{name} PCA by CC Phase"), subtitle = glue("{numCells} Malignant Cells")) +
theme(plot.title = element_text(hjust = 0.5, size = 10)) +
scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
byscore <- FeaturePlot(obj, features = c("S.Score.centered", "G2M.Score.centered"), pt.size = 0.5, reduction = "pca",combine = FALSE)
byscore[[1]] <- byscore[[1]] + labs(title = glue("{name} PCA by centered S Score"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
byscore[[2]] <- byscore[[2]] + labs(title = glue("{name} PCA by centered G2M Score"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
bynFnC <- FeaturePlot(obj, features = c("nCount_RNA", "nFeature_RNA"), reduction = "pca", pt.size = 0.5, combine = FALSE)
bynFnC[[1]] <- bynFnC[[1]] + labs(title = glue("{name} PCA by nCount"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
bynFnC[[2]] <- bynFnC[[2]] + labs(title = glue("{name} PCA by nFeature"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 10))
ccPCA.plots[[i]] <- byt + bycc + byscore[[1]] + byscore[[2]] + bynFnC[[1]] + bynFnC[[2]]
}
ccPCA.plots[["DF20"]]

ccPCA.plots[["DF101"]]

ccPCA.plots[["DF68"]]

We will investigate further into the correlation between treatment status, hallmark scores, and cell cycle phase in the next sections.
5) Investigating Correlation between nCount, nFeature and Hallmark Scores * Here, we investigate whether there is a correlation between nCount, nFeature and Hallmark Scores. It is possible that cells that appear to have higher OXPHOS counts simply have higher nCount or nFeature in general. * This would bring bias to our analysis because it is possible that cells that appear to have enriched or depleted OXPHOS expression actually have more or less (dropouts) genes than other cells in general. * Although this bias in gene count should have been addressed by RPKM/CPM/TPM normalization, we would still like to confirm that the differential expression of our hallmarks of interest is not driven by technical (rather than biological) factors such as nFeature/nCount.
#DF20 -------
DF20.oxphosVsnCount <- ggplot(PDX_DF20@meta.data, aes(x = nCount_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF20 OXPHOS vs. nCount", subtitle = paste(nrow(PDX_DF20@meta.data),"Malignant Cells", "(R = 0.52, p < 2.2e-16)"))
DF20.oxphosVsnFeature <- ggplot(PDX_DF20@meta.data, aes(x = nFeature_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF20 OXPHOS vs. nFeature", subtitle = paste(nrow(PDX_DF20@meta.data),"Malignant Cells", "(R = 0.42, p < 2.2e-16)"))
#DF101 -------
DF101.oxphosVsnCount <- ggplot(PDX_DF101@meta.data, aes(x = nCount_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF101 OXPHOS vs. nCount", subtitle = paste(nrow(PDX_DF101@meta.data),"Malignant Cells", "(R = 0.37, p < 2.7e-06)"))
DF101.oxphosVsnFeature <- ggplot(PDX_DF101@meta.data, aes(x = nFeature_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF101 OXPHOS vs. nFeature", subtitle = paste(nrow(PDX_DF101@meta.data),"Malignant Cells", "(R = 0.44, p < 1.1e-08)"))
#DF68 -------
DF68.oxphosVsnCount <- ggplot(PDX_DF68@meta.data, aes(x = nCount_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF68 OXPHOS vs. nCount", subtitle = paste(nrow(PDX_DF68@meta.data),"Malignant Cells", "(R = 0.46, p < 3.2e-09)"))
DF68.oxphosVsnFeature <- ggplot(PDX_DF68@meta.data, aes(x = nFeature_RNA, y = GO.OXPHOS35.centered)) +
geom_point(alpha = 0.5, aes(colour = treatment.status)) +
theme_bw() +
labs(title = "PDX DF68 OXPHOS vs. nFeature", subtitle = paste(nrow(PDX_DF68@meta.data),"Malignant Cells", "(R = 0.42, p < 1.3e-07)"))
DF20.oxphosVsnCount + DF20.oxphosVsnFeature + DF101.oxphosVsnCount + DF101.oxphosVsnFeature + DF68.oxphosVsnCount + DF68.oxphosVsnFeature + plot_layout(ncol =2, nrow = 3)

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] ggbeeswarm_0.6.0 ggpubr_0.4.0 GGally_2.0.0 gt_0.2.1 reshape2_1.4.4
[6] tidyselect_1.1.0 fgsea_1.14.0 presto_1.0.0 data.table_1.12.8 Rcpp_1.0.5
[11] glue_1.4.1 patchwork_1.0.1 EnhancedVolcano_1.6.0 ggrepel_0.8.2 here_0.1
[16] readxl_1.3.1 forcats_0.5.0 stringr_1.4.0 dplyr_1.0.0 purrr_0.3.4
[21] readr_1.3.1 tidyr_1.1.0 tibble_3.0.3 ggplot2_3.3.2 tidyverse_1.3.0
[26] cowplot_1.0.0 Seurat_3.1.5 BiocManager_1.30.10 renv_0.11.0-4
loaded via a namespace (and not attached):
[1] backports_1.1.8 fastmatch_1.1-0 workflowr_1.6.2 plyr_1.8.6 igraph_1.2.5
[6] lazyeval_0.2.2 splines_4.0.2 BiocParallel_1.22.0 listenv_0.8.0 digest_0.6.25
[11] htmltools_0.5.0 fansi_0.4.1 magrittr_1.5 cluster_2.1.0 ROCR_1.0-11
[16] openxlsx_4.1.5 globals_0.12.5 modelr_0.1.8 colorspace_1.4-1 blob_1.2.1
[21] rvest_0.3.5 haven_2.3.1 xfun_0.15 crayon_1.3.4 jsonlite_1.7.0
[26] survival_3.2-3 zoo_1.8-8 ape_5.4 gtable_0.3.0 leiden_0.3.3
[31] car_3.0-8 future.apply_1.6.0 abind_1.4-5 scales_1.1.1 DBI_1.1.0
[36] rstatix_0.6.0 viridisLite_0.3.0 reticulate_1.16 foreign_0.8-80 rsvd_1.0.3
[41] tsne_0.1-3 htmlwidgets_1.5.1 httr_1.4.1 RColorBrewer_1.1-2 ellipsis_0.3.1
[46] ica_1.0-2 farver_2.0.3 pkgconfig_2.0.3 reshape_0.8.8 uwot_0.1.8
[51] dbplyr_1.4.4 labeling_0.3 rlang_0.4.7 later_1.1.0.1 munsell_0.5.0
[56] cellranger_1.1.0 tools_4.0.2 cli_2.0.2 generics_0.0.2 broom_0.7.0
[61] ggridges_0.5.2 evaluate_0.14 yaml_2.2.1 knitr_1.29 fs_1.4.2
[66] fitdistrplus_1.1-1 zip_2.0.4 RANN_2.6.1 pbapply_1.4-2 future_1.18.0
[71] nlme_3.1-148 whisker_0.4 xml2_1.3.2 compiler_4.0.2 rstudioapi_0.11
[76] beeswarm_0.2.3 plotly_4.9.2.1 curl_4.3 png_0.1-7 ggsignif_0.6.0
[81] reprex_0.3.0 stringi_1.4.6 lattice_0.20-41 Matrix_1.2-18 vctrs_0.3.2
[86] pillar_1.4.6 lifecycle_0.2.0 lmtest_0.9-37 RcppAnnoy_0.0.16 irlba_2.3.3
[91] httpuv_1.5.4 R6_2.4.1 promises_1.1.1 KernSmooth_2.23-17 gridExtra_2.3
[96] rio_0.5.16 vipor_0.4.5 codetools_0.2-16 MASS_7.3-51.6 assertthat_0.2.1
[101] rprojroot_1.3-2 withr_2.2.0 sctransform_0.2.1 parallel_4.0.2 hms_0.5.3
[106] grid_4.0.2 rmarkdown_2.3 carData_3.0-4 Rtsne_0.15 git2r_0.27.1
[111] lubridate_1.7.9