Last updated: 2020-08-21

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 8bfebbe. 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/02.0_Izar2020_SS2_ExploratoryAnalysis.Rmd) and HTML (docs/02.0_Izar2020_SS2_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
Rmd 8bfebbe jgoh2 2020-08-21 SS2 PCA matrix
html 2c1accf jgoh2 2020-08-19 Build site.
Rmd 729ebf4 jgoh2 2020-08-19 workflowr::wflow_publish(files = files)
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)
Rmd 1263ec1 jgoh2 2020-08-04 PDX choices GSEA ranking
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 8b4b72f jgoh2 2020-07-31 Build site.
Rmd 21a445c jgoh2 2020-07-31 workflowr::wflow_publish(files = “analysis/02.0_Izar2020_SS2_ExploratoryAnalysis.Rmd”)
html a15430b jgoh2 2020-07-31 Build site.
Rmd b0c12c7 jgoh2 2020-07-31 workflowr::wflow_publish(files = “analysis/02.0_Izar2020_SS2_ExploratoryAnalysis.Rmd”)
html 2dc1bee jgoh2 2020-07-31 Build site.
Rmd 284aad4 jgoh2 2020-07-31 workflowr::wflow_publish(files = files)

IZAR 2020 SS2 (COHORT 2) DATA ANALYSIS - PART 2

OVERVIEW

  • The SS2 data from Izar2020 consists of cells from 14 ascites samples from 6 individuals:
    • selected for malignant EPCAM+CD24+ cells by fluorophore-activated cell sorting into 96-well plates
    • Includes both malignant and nonmalignant populations but differs from 10X data - examines malignant ascites more closely.
    • We are only interested in the malignant ascites population, specifically samples from patient 8 and 9 because they are the only patients that have samples from different treatment statuses.
  • In our 5-part analysis of the Izar 2020 SS2 data, we are interested in identifying differentially expressed genes and hallmark genesets between treatment statuses within patients 8 and 9
  • We split our SS2 analysis into three parts:
    1. Load Data and Create SS2 Seurat Object
      1. The code to this part of our analysis is in the read_Izar_2020.R file in the code folder. During this part of our analysis we:
        1. Load in SS2 count matrix and Create Seurat Object
        2. Assign Metadata identities including:
          • Patient ID
          • Time
          • Sample ID
          • Treatment Status
        3. Score cells for cell cycle and hallmark genesets - Note: It does not matter whether we call AddModuleScore before or after subsetting and scaling each model because AddModuleScore uses the data slot.
        4. Save Seurat Object
    2. Process Data and Exploratory Data Analysis
      1. The code to this part of our analysis can be found in the 02_Izar2020_SS2_Load_Plots file in the old/edited folder. During this part of our analysis we:
        1. Load in SS2 Seurat Object from Part 1 and subset by patients 8 and 9. Continue analysis separately for each model.
        2. Scale and FindVariableFeatures (prepares data for dimensionality reduction)
        3. Dimensionality Reduction (PCA + UMAP)
        4. Save Seurat Objects
    3. Exploratory Data Analysis
      1. The code to this part of our analysis can be found in the 02.0_Izar2020_SS2_Exploratory Analysis file in the analysis folder. During this part of our analysis we:
        1. Load in SS2 Seurat Object from Part 2. Analyze separately for patients 8 and 9
        2. Compute summary metrics for SS2 data such as:
          • Number of cells per patient per treatment
          • Number of cells per treatment per cell cycle phase
        3. Visualize how cells separate based on metadata identities via UMAP and PCA - Intermodel heterogeneity: How do cells separate by sample? - Intramodel heterogeneity:
          • How do cells separate by treament status / sample?
          • How do cells separate by cell cycle phase?
    4. DE Analysis
      1. TYPE #1 DE ANALYSIS: Visualizing and Quantifying Differentially Expression on Predefined GO Genesets
        1. Violin Plots and UMAP
        2. Gene Set Enrichment Analysis (GSEA)
      2. TYPE #2 DE ANALYSIS: Finding DE Genes from scratch
        1. Volcano Plots
    5. CELL CYCLE ANALYSIS
      1. TYPE #1 CELL CYCLE ANALYSIS: Examine correlation between treatment condition and cell cycle phase
      2. Evaluate the idea that cell cycle might influence expression of signatures

This is the third part of our 5-part analysis of the Izar 2020 SS2 (Cohort 2) data.

STEP 1 LOAD SEURAT OBJECT

# Load packages
source(here::here('packages.R'))

#Read in SS2 RDS object
SS2Malignant = readRDS(file = "data/Izar_2020/jesslyn_SS2Malignant_processed.RDS")
SS2Malignant8.9 = readRDS(file = "data/Izar_2020/jesslyn_SS2Malignant89_processed.RDS")
SS2Malignant.8 = readRDS(file = "data/Izar_2020/jesslyn_SS2Malignant8_processed.RDS")
SS2Malignant.9 = readRDS(file = "data/Izar_2020/jesslyn_SS2Malignant9_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(SS2Malignant@meta.data)[14:61]

for(i in hm.names){
    SS2Malignant.hm.centered <- scale(SS2Malignant[[i]], center = TRUE, scale = FALSE)
    SS2Malignant <- AddMetaData(SS2Malignant, SS2Malignant.hm.centered, col.name = glue("{i}.centered"))
    
    SS2Malignant8.hm.centered <- scale(SS2Malignant.8[[i]], center = TRUE, scale = FALSE)
    SS2Malignant.8 <- AddMetaData(SS2Malignant.8, SS2Malignant8.hm.centered, col.name = glue("{i}.centered"))
    
    SS2Malignant9.hm.centered <- scale(SS2Malignant.9[[i]], center = TRUE, scale = FALSE)
    SS2Malignant.9 <- AddMetaData(SS2Malignant.9, SS2Malignant9.hm.centered, col.name = glue("{i}.centered"))
}

STEP 2 EXAMINE SUMMARY METRICS

#numMalignantCellsPerSample
numMalignantCellsPerSample <- table(SS2Malignant$sample, SS2Malignant$cell.type, SS2Malignant$treatment.status) %>%
  as.data.frame() %>% 
  dplyr::rename(sample = Var1, celltype = Var2, treatment = Var3, numCells = Freq) %>% 
  filter(`celltype` == "Malignant")
ggplot(numMalignantCellsPerSample, aes(x = sample, y=numCells, fill = treatment)) + 
  theme_bw() + 
  geom_bar(stat = "identity") + 
  labs(title = "Number of Malignant Cells Per Sample in SS2 Data") 

Version Author Date
84edf85 jgoh2 2020-08-12
d801a7a jgoh2 2020-08-04
2dc1bee jgoh2 2020-07-31
numMalignantCellsPerPatientPerTreatment <- table(SS2Malignant$Patient, SS2Malignant$treatment.status) %>%
  as.data.frame() %>% 
  dplyr::rename(Patient = Var1, treatment = Var2, numCells = Freq) 
numCells.NA <- numMalignantCellsPerPatientPerTreatment$numCells
numCells.NA[2] <- 252
ggplot(numMalignantCellsPerPatientPerTreatment, aes(x = Patient, y=numCells, fill = treatment)) + 
  geom_bar(position = "fill", stat = "identity") + 
  theme_bw() + 
  labs(title = "SS2 Percent of Malignant Cells Per Patient Per Treatment") + 
  geom_text(aes(label = paste(numCells.NA, "Cells")), size =4, position = "fill", hjust = 0.5, vjust = 4, color = "white", na.rm = TRUE) + 
  scale_y_continuous(labels = scales::percent)

Version Author Date
84edf85 jgoh2 2020-08-12
d801a7a jgoh2 2020-08-04
a15430b jgoh2 2020-07-31
2dc1bee jgoh2 2020-07-31
numMalignantCellsPerPatientPerSample <- table(SS2Malignant$Patient, SS2Malignant$sample) %>%
  as.data.frame() %>% 
  dplyr::rename(Patient = Var1, sample = Var2, numCells = Freq) %>% 
  filter(numCells != 0)
ggplot(numMalignantCellsPerPatientPerSample, aes(x = Patient, y=numCells, fill = sample)) + 
  geom_bar(position = "fill", stat = "identity") + 
  theme_bw() + 
  labs(title = "SS2 Percent of Malignant Cells Per Patient Per Sample", x = "Percent of Cells") + 
  geom_text(aes(label = paste(numCells, "Cells")), size =4, position = "fill", hjust = 0.5, vjust = 1.5, color = "white", na.rm = TRUE) +
  scale_fill_manual(values = c("#00AFBB", "#E7B800", "orange", "chocolate1", "chocolate2", "#00AFBB", "#E7B800", "orange", "#00AFBB", "#E7B800", "orange", "#00AFBB", "#00AFBB", "#00AFBB")) + 
    scale_y_continuous(labels = scales::percent)

Version Author Date
84edf85 jgoh2 2020-08-12
a3ddf54 jgoh2 2020-08-07
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
a15430b jgoh2 2020-07-31
#metrics for patient 8 and 9
numMalignantCellsPerSample.8 <- table(SS2Malignant.8$Patient, SS2Malignant.8$sample) %>%
  as.data.frame() %>% 
  dplyr::rename(Patient = Var1, sample = Var2, numCells = Freq)
p8 <- ggplot(numMalignantCellsPerSample.8, aes(x = Patient, y = numCells, fill = sample)) + 
    geom_bar(position = "fill", stat = "identity") + 
  theme_bw() + 
    labs(title = "Percent of Malignant Cells Per Sample in Patient 8") + 
    geom_text(aes(label = c("Treatment-naïve", "On-treatment Timepoint #1", "On-treatment Timepoint #2")), position = "fill", hjust = 0.5, vjust = 2, color = "white", size = 4) + 
    geom_text(aes(label = paste(numCells, "cells")), size =4, position = "fill", hjust = 0.5, vjust = 4, color = "white") + 
      scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07")) + 
    scale_y_continuous(labels = scales::percent)

numMalignantCellsPerSample.9 <- table(SS2Malignant.9$Patient, SS2Malignant.9$sample) %>%
  as.data.frame() %>% 
  dplyr::rename(Patient = Var1, sample = Var2, numCells = Freq)
p9 <- ggplot(numMalignantCellsPerSample.9, aes(x = Patient, y = numCells, fill = sample)) + 
    geom_bar(position = "fill", stat = "identity") + 
  theme_bw() + 
    labs(title = "Percent of Malignant Cells Per Sample in Patient 9") + 
    geom_text(aes(label = c("Treatment-naïve", "On-treatment Timepoint #1", "On-treatment Timepoint #2")), position = "fill", hjust = 0.5, vjust = 2, color = "white", size = 4) + 
    geom_text(aes(label = paste(numCells, "cells")), size =4, position = "fill", hjust = 0.5, vjust = 4, color = "white") + 
  scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07")) + 
    scale_y_continuous(labels = scales::percent)

p <- p8 + p9
p

Version Author Date
84edf85 jgoh2 2020-08-12
a3ddf54 jgoh2 2020-08-07

The summary metrics of each patient shows us how little cells we have in each sample. 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.

STEP 3 UMAP & PCA VISUALIZATIONS

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 SAMPLE

#cluster by patient/ sample? 
p1 <- UMAPPlot(SS2Malignant, group.by = "Patient", pt.size= 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Patient", subtitle = paste(nrow(SS2Malignant@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))
p2 <- UMAPPlot(SS2Malignant, group.by = "sample", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Sample", subtitle = paste(nrow(SS2Malignant@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))

p3 <- UMAPPlot(SS2Malignant, group.by = "treatment.status", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Treatment", subtitle = paste(nrow(SS2Malignant@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))

p4 <- UMAPPlot(SS2Malignant, group.by = "Phase", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by CC Phase", subtitle = paste(nrow(SS2Malignant@meta.data),"Malignant Cells")) + 
  coord_fixed() +
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07")) + 
  theme(plot.title = element_text(size = 14))

p1 + p3 + p4

Version Author Date
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
#only patient 8 and 9 
p5 <- UMAPPlot(SS2Malignant8.9, group.by = "Patient", pt.size= 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Patients 8 and 9", subtitle = paste(nrow(SS2Malignant8.9@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))
p6 <- UMAPPlot(SS2Malignant8.9, group.by = "sample", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Sample", subtitle = paste(nrow(SS2Malignant8.9@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))

p7 <- UMAPPlot(SS2Malignant8.9, group.by = "treatment.status", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by Treatment", subtitle = paste(nrow(SS2Malignant8.9@meta.data),"Malignant Cells")) + 
  coord_fixed()  + 
  theme(plot.title = element_text(size = 14))

p8 <- UMAPPlot(SS2Malignant8.9, group.by = "Phase", pt.size = 0.5) + 
  labs(title = "SS2 Malignant Cells UMAP by CC Phase", subtitle = paste(nrow(SS2Malignant8.9@meta.data),"Malignant Cells")) + 
  coord_fixed() +
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07")) + 
  theme(plot.title = element_text(size = 14))

p5 + p7 + p8

Version Author Date
a3ddf54 jgoh2 2020-08-07
  • SS2 data separates by patient very well. However, it doesn’t seem like it separates by sample within each patient. We will investigate this further by looking into patient 8 and 9 specifically.

2) BY TREATMENT STATUS WITHIN EACH MODEL

#Patient 8 ---------
p4 <- UMAPPlot(SS2Malignant.8, group.by = "treatment.status") + 
  labs(title = "SS2 UMAP Patient 8 by Treatment", subtitle = paste(nrow(SS2Malignant.8@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12))
p5 <- UMAPPlot(SS2Malignant.8, group.by = "sample") + 
  labs(title = "SS2 UMAP Patient 8 by Sample", subtitle = paste(nrow(SS2Malignant.8@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12)) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))


p6 <- PCAPlot(SS2Malignant.8, group.by = "sample") + 
  labs(title = "SS2 PCA Patient 8 by Sample", subtitle = paste(nrow(SS2Malignant.8@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12)) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
p4 + p5 + p6 + plot_layout(guides = "collect")

Version Author Date
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
#Patient 9 -----------
p7 <- UMAPPlot(SS2Malignant.9, group.by = "treatment.status") + 
  labs(title = "SS2 UMAP Patient 9 by Treatment", subtitle = paste(nrow(SS2Malignant.9@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12))
p8 <- UMAPPlot(SS2Malignant.9, group.by = "sample") + 
  labs(title = "SS2 UMAP Patient 9 by Sample", subtitle = paste(nrow(SS2Malignant.9@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12)) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
p9 <- PCAPlot(SS2Malignant.9, group.by = "sample") + 
  labs(title = "SS2 PCA Patient 9 by Sample", subtitle = paste(nrow(SS2Malignant.9@meta.data),"Malignant Cells")) + 
  theme(plot.title = element_text(size = 12)) + 
  scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
p7 + p8 + p9 + plot_layout(guides = "collect")

Version Author Date
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
  • Seems like cells do not cluster together by treatment status.
  • Treatment status is also not captured in PC_1 or PC_2

3) BY UPR AND OXPHOS GENESET SCORE

hms.centered = c("GO.OXPHOS35.centered", "UNUPDATED.UPR38.centered")
#UMAP 
SS2.names <- c("SS2 Patient 8", "SS2 Patient 9")
SS2s <- c(SS2Malignant.8, SS2Malignant.9)
UMAP.plots <- vector("list", length(SS2s))
names(UMAP.plots) <- SS2.names

for (i in 1:length(SS2s)){
  obj <- SS2s[[i]]
  name <- SS2.names[[i]]
  numCells = nrow(obj@meta.data)
  
  p <- FeaturePlot(obj, features = hms.centered, combine = FALSE)
  p[[1]] <- p[[1]] + labs(title = glue("{name} UMAP by OXPHOS Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "GO_OXIDATIVE_PHOSPHORYLATION") +
    coord_fixed()
  p[[2]] <- p[[2]] + labs(title = glue("{name} UMAP by UPR Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "HALLMARK_UNFOLDED_PROTEIN_RESPONSE") + 
    coord_fixed()
  
  p2 <- FeaturePlot(obj, features = hms.centered, reduction = "pca", combine = FALSE)
  p2[[1]] <- p2[[1]] + labs(title = glue("{name} PCA by OXPHOS Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "GO_OXIDATIVE_PHOSPHORYLATION") +
    coord_fixed()
  p2[[2]] <- p2[[2]] + labs(title = glue("{name} PCA by UPR Scores"), subtitle = glue("{numCells} Malignant Cells"), caption = "HALLMARK_UNFOLDED_PROTEIN_RESPONSE") + 
    coord_fixed()
  
  UMAP.plots[[name]] <- p[[1]] + p[[2]] + p2[[1]] + p2[[2]]
}

UMAP.plots[["SS2 Patient 8"]]

Version Author Date
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
UMAP.plots[["SS2 Patient 9"]]

Version Author Date
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
  • There isn’t a clear clustering of cells due to OXPHOS or UPR scores, but it seems like OXPHOS scores might be faintly captured in PC_1, where cells with higher OXPHOS scores tend to be around the same area on the PC_1 axis.

4) BY CELL CYCLE PHASE AND BY nFEATURE/ nCOUNT

#PCA -------------------- (PCA is known to separate cell by cell cycle really well)
ccPCA.plots <- vector("list", length = 3)
names(ccPCA.plots) <- SS2.names

for(i in 1:length(SS2s)){
  obj = SS2s[[i]]
  name = SS2.names[[i]]
  numCells = nrow(obj@meta.data)
  obj$Phase <- factor(obj$Phase, levels = c("G1", "S", "G2M"))
  
  bys <- PCAPlot(obj, group.by = "sample") + 
    labs(title = glue("{name} PCA by sample"), subtitle = glue("{numCells} Malignant Cells")) +
    theme(plot.title = element_text(hjust = 0.5)) + theme(plot.title = element_text(size = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed() + 
    scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
  
  bycc <- PCAPlot(obj, group.by = "Phase") + 
    labs(title = glue("{name} PCA by Cell Cycle Phase"), subtitle = glue("{numCells} Malignant Cells")) + 
    theme(plot.title = element_text(hjust = 0.5)) + theme(plot.title = element_text(size = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed() + 
    scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07"))
  
  byscore <- FeaturePlot(obj, features = c("S.Score", "G2M.Score.centered"), 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 = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed()
  byscore[[2]] <- byscore[[2]] + labs(title = glue("{name} PCA by centered G2M Score"), subtitle = glue("{numCells} Malignant Cells")) + theme(plot.title = element_text(size = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed()
  
  bynFnC <- FeaturePlot(obj, features = c("nCount_RNA", "nFeature_RNA"), reduction = "pca", combine = FALSE)
  bynFnC[[1]] <- bynFnC[[1]] + labs(title = glue("{name} PCA by nCount"), subtitle = glue("{numCells} Malignant Cells")) + 
    theme(plot.title = element_text(size = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed()
  bynFnC[[2]] <- bynFnC[[2]] + labs(title = glue("{name} PCA by nFeature"), subtitle = glue("{numCells} Malignant Cells")) + 
    theme(plot.title = element_text(size = 12), plot.subtitle = element_text(size = 10)) + 
    coord_fixed()

  ccPCA.plots[[i]] <- bys + bycc + byscore[[1]] + byscore[[2]] + bynFnC[[1]] + bynFnC[[2]]
}

ccPCA.plots[["SS2 Patient 8"]]

Version Author Date
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
ccPCA.plots[["SS2 Patient 9"]]

Version Author Date
d801a7a jgoh2 2020-08-04
26f64a3 jgoh2 2020-08-03
2dc1bee jgoh2 2020-07-31
  • Although it doesn’t seem like the cells cluster by treatment condition within each model, it does seem like cells in the same cell cycle phase, especially those with higher S or G2M scores tend to be near each other on UMAP space.
    • Looking at the PCA plots, we see that:
      • PC_2 captures Cell Cycle Phase, S.Score and G2M scores, as cells in the same phase or have high S or G2M scores are found to be near each other on the PC_2 Axis.
      • PC_1 captures nCount and nFeature variation, as cells with higher nCount and nFeature values are near each other on the PC_1 Axis.
    • However, it is hard to tell whether there is a correlation between treatment condition and cell cycle phase / score based on these plots.

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 Our PCA visualizations above suggest that OXPHOS socres may be faintly captured by PC_1, where cells with higher OXPHOS scores tend to be around the same area on the PC_1 axis. However, our PCA visualization of nFeature and nCount reveal that PC_1 strongly captures nCount and nFeature variation, and the same cells with higher OXPHOS scores seem to also have higher nFeature and nCount.

  • 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.
P8.oxphosVsnCount <- ggplot(SS2Malignant.8@meta.data) + 
  geom_point(alpha = 0.5, aes(x = nCount_RNA, y = GO.OXPHOS35.centered, colour = sample)) + 
  theme_bw() +
  labs(title = "SS2 Patient 8 Malignant Cells OXPHOS vs. nCount", subtitle = paste(nrow(SS2Malignant.8@meta.data),"Malignant Cells", "(R = 0.25, p = 9.2e-04)")) + 
    theme(plot.title = element_text(size = 12))

P8.oxphosVsnFeature <- ggplot(SS2Malignant.8@meta.data, aes(x = nFeature_RNA, y = GO.OXPHOS35.centered)) + 
  geom_point(alpha = 0.5, aes(colour = sample)) + 
  geom_abline(intercept = -0.5, slope = 1) +
  theme_bw() + 
  labs(title = "SS2 Patient 8 Malignant Cells OXPHOS vs. nFeature", subtitle = paste(nrow(SS2Malignant.8@meta.data),"Malignant Cells", "(R = 0.34, p = 3.9e-06)")) + 
  theme(plot.title = element_text(size = 12))

P9.oxphosVsnCount <- ggplot(SS2Malignant.9@meta.data, aes(x = nCount_RNA, y = GO.OXPHOS35.centered)) + 
  geom_point(alpha = 0.5, aes(colour = sample)) + 
  theme_bw() + 
  labs(title = "SS2 Patient 9 Malignant Cells OXPHOS vs. nCount", subtitle = paste(nrow(SS2Malignant.9@meta.data),"Malignant Cells", "(R = -0.021, p = 0.76)")) + 
    theme(plot.title = element_text(size = 12))

P9.oxphosVsnFeature <- ggplot(SS2Malignant.9@meta.data, aes(x = nFeature_RNA, y = GO.OXPHOS35.centered)) + 
  geom_point(alpha = 0.5, aes(colour = sample)) + 
  geom_abline(intercept = -0.5, slope = 1) +
  theme_bw() + 
  labs(title = "SS2 Patient 9 Malignant Cells OXPHOS vs. nFeature", subtitle = paste(nrow(SS2Malignant.9@meta.data),"Malignant Cells", "(R = 0.051, p = 0.45)")) + 
    theme(plot.title = element_text(size = 12))

P8.oxphosVsnCount + P8.oxphosVsnFeature + P9.oxphosVsnCount + P9.oxphosVsnFeature + plot_layout(guides= 'collect')

Version Author Date
26f64a3 jgoh2 2020-08-03
  • There doesn’t seem to be a correlation between OXPHOS and nFeature/nCount
  • We are interested in discovering which PC captures OXPHOS and UPR scores

6) Investigating PC that captures OXPHOS and/or UPR scores

#GO.OXPHOS --------------
P8.PCA.cells <- SS2Malignant.8@reductions$pca@cell.embeddings %>% as.data.frame()
Oxphos.ctg <- rep("NA", length = nrow(SS2Malignant.8@meta.data))
Oxphos.ctg[SS2Malignant.8$GO.OXPHOS35.centered > 0.25] <- "Highly Upregulated"
Oxphos.ctg[SS2Malignant.8$GO.OXPHOS35.centered < 0.25 & SS2Malignant.8$GO.OXPHOS35.centered > 0] <- "Slightly Upregulated"
Oxphos.ctg[SS2Malignant.8$GO.OXPHOS35.centered == 0] <- "Not Expressed"
Oxphos.ctg[SS2Malignant.8$GO.OXPHOS35.centered > -0.25 & SS2Malignant.8$GO.OXPHOS35.centered < 0] <- "Slightly Downregulated"
Oxphos.ctg[SS2Malignant.8$GO.OXPHOS35.centered < -0.25] <- "Highly Downregulated"

p1 <- ggpairs(P8.PCA.cells, columns = c("PC_1", "PC_2", "PC_3", "PC_4", "PC_5"), diag = "blank", lower = list(continuous = wrap("points", size = 1)), mapping = aes(alpha = 0.7, colour = Oxphos.ctg)) +
  scale_color_brewer(palette="Purples", guide = "legend") +
  labs(title = "Investigating the PC that captures OXPHOS scores variation across cells (PC1-PC5)")

p1

Version Author Date
2c1accf jgoh2 2020-08-19
a3ddf54 jgoh2 2020-08-07
p2 <- ggpairs(P8.PCA.cells, columns = c("PC_6", "PC_7", "PC_8", "PC_9", "PC_10"), diag = "blank", lower = list(continuous = wrap("points", size = 1)), mapping = aes(alpha = 0.7, colour = Oxphos.ctg)) +
  scale_color_brewer(palette="Purples", guide = "legend") +
  labs(title = "Investigating the PC that captures OXPHOS scores variation across cells (PC6-PC10)")

p2

Version Author Date
2c1accf jgoh2 2020-08-19
a3ddf54 jgoh2 2020-08-07

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