From 58b3b9dba5c740af825d713668c7bcd0fd08a39f Mon Sep 17 00:00:00 2001
From: John Lafin <john.lafin@utsouthwestern.edu>
Date: Wed, 12 Feb 2025 16:39:53 -0600
Subject: [PATCH] Update labels to include JUN/FOS epi

---
 scripts/04_annotation.R  | 21 ++++++++-------
 scripts/05_female_only.R | 56 ++++++++++++++++++++++------------------
 2 files changed, 43 insertions(+), 34 deletions(-)

diff --git a/scripts/04_annotation.R b/scripts/04_annotation.R
index 467d10f..5e98f6e 100644
--- a/scripts/04_annotation.R
+++ b/scripts/04_annotation.R
@@ -84,11 +84,11 @@ annot.list$Epithelia <- c("transitional basal epithelia of urethra",
                           "transitional intermediate epithelia of urethra",
                           "squamous intermediate epithelia of urethra",
                           "luminal epithelia of prostate",
-                          "club epithelia of urethra",
+                          "transitional luminal epithelia of urethra",
                           "transitional intermediate epithelia of urethra",
-                          "club epithelia of urethra",
-                          "stressed cells",
-                          "stressed cells",
+                          "transitional luminal epithelia of urethra",
+                          "transitional basal (JUN/FOS hi) epithelia of urethra",
+                          "transitional basal (JUN/FOS hi) epithelia of urethra",
                           "squamous intermediate epithelia of urethra",
                           "squamous intermediate epithelia of urethra",
                           "basal epithelia of prostate",
@@ -96,7 +96,7 @@ annot.list$Epithelia <- c("transitional basal epithelia of urethra",
                           "basal epithelia of prostate",
                           "proliferative cells",
                           "squamous luminal epithelia of urethra",
-                          "stressed cells",
+                          "transitional basal (JUN/FOS hi) epithelia of urethra",
                           "transitional basal epithelia of urethra",
                           "basal epithelia of prostate")
 annot.list$Leukocyte <- c("T cell",
@@ -121,11 +121,11 @@ annot.list$Stroma <- c("pericyte",
                        "periepithelial fibroblast of urethra",
                        "stressed cell",
                        "pericyte",
-                       "glia",
+                       "satellite glial cell",
                        "smooth muscle cell",
                        "endoneurial fibroblast",
                        "pericyte",
-                       "glia")
+                       "satellite glial cell")
 
 ## Set epithelia and stroma to higher resolutions
 Idents(lin.list$Epithelia) <- "RNA_snn_res.1.5"
@@ -150,7 +150,7 @@ VlnPlot(lin.list$Epithelia, "NE.score", group.by = "orig.ident") +
 ggsave(paste0(annotdir, "NE_score_cutoff.png"))
 
 lin.list$Epithelia@meta.data <- lin.list$Epithelia@meta.data %>%
-  mutate(cellannotation = if_else(NE.score > 0.3, "neuroendocrine cell", cellannotation))
+  mutate(cellannotation = if_else(NE.score > 0.3, "neuroendocrine epithelia", cellannotation))
 
 ## Add ionocytes
 VlnPlot(lin.list$Epithelia, "FOXI1", group.by = "orig.ident") + 
@@ -197,13 +197,16 @@ for (lin in names(lin.list)) {
 
 ## Define stressed clusters based on violin plots
 stressed.cells <- list()
-stressed.cells$Epithelia <- c(11,12,20)
 stressed.cells$Stroma <- c(2,10,15)
 stressed.cells$Endothelia <- c(4,10)
 stressed.cells$Leukocyte <- c(4,9)
 
 ## Remove stressed clusters and reprocess
 for (lin in names(lin.list)) {
+  if (!(lin %in% names(stressed.cells))) {
+    Idents(lin.list[[lin]]) <- "cellannotation"
+    next
+  }
   lin.list[[lin]] <- subset(lin.list[[lin]], 
                             idents = stressed.cells[[lin]],
                             invert = TRUE)
diff --git a/scripts/05_female_only.R b/scripts/05_female_only.R
index 2a5e2eb..fd6a7e7 100644
--- a/scripts/05_female_only.R
+++ b/scripts/05_female_only.R
@@ -64,22 +64,29 @@ lin.list <- subset(seu, subset = Sex == "female") %>%
   SplitObject(split.by="Lineage")
 
 ## Preprocess each lineage
-lin.list <- future_lapply(lin.list, preprocess, default.res="cellannotation")
+lin.list <- future_lapply(lin.list, preprocess, default.res="cellannotation", future.seed=TRUE)
 
 # Update annotation -------------------------------------------------------
 
 ## Epithelia
-Idents(lin.list$Epithelia) <- "RNA_snn_res.0.5"
-cluster.ids <- c("0" = "intermediate cell of transitional epithelia",
-                 "1" = "basal cell of transitional epithelia",
-                 "2" = "basal cell of squamous epithelia",
-                 "3" = "intermediate cell of squamous epithelia",
-                 "4" = "club cell",
-                 "5" = "intermediate cell of squamous epithelia",
-                 "6" = "intermediate cell of squamous epithelia",
-                 "7" = "luminal cell of squamous epithelia",
-                 "8" = "proliferative cells",
-                 "9" = "basal cell of transitional epithelia")
+Idents(lin.list$Epithelia) <- "RNA_snn_res.1"
+cluster.ids <- c("0" = "transitional basal epithelia of urethra",
+                "1" = "squamous intermediate epithelia of urethra",
+                "2" = "transitional luminal epithelia of urethra",
+                "3" = "transitional intermediate epithelia of urethra",
+                "4" = "transitional basal (JUN/FOS hi) epithelia of urethra",
+                "5" = "squamous basal epithelia of urethra",
+                "6" = "transitional intermediate epithelia of urethra",
+                "7" = "squamous intermediate epithelia of urethra",
+                "8" = "squamous intermediate epithelia of urethra",
+                "9" = "squamous luminal epithelia of urethra",
+                "10" = "proliferative cells",
+                "11" = "transitional basal epithelia of urethra",
+                "12" = "squamous luminal epithelia of urethra",
+                "13" = "transitional basal epithelia of urethra"
+                 )
+names(cluster.ids) <- seq(0, length(cluster.ids)-1, 1)
+
 lin.list$Epithelia <- RenameIdents(lin.list$Epithelia, cluster.ids) %>%
   StashIdent("cellannotation")
 
@@ -91,7 +98,7 @@ lin.list$Epithelia <- AddModuleScore(lin.list$Epithelia,
                        name = "NE.score")
 lin.list$Epithelia@meta.data <- rename(lin.list$Epithelia@meta.data, NE.score = NE.score1)
 lin.list$Epithelia@meta.data <- lin.list$Epithelia@meta.data %>%
-  mutate(cellannotation = if_else(NE.score > 0.3, "neuroendocrine cell", cellannotation))
+  mutate(cellannotation = if_else(NE.score > 0.3, "neuroendocrine epithelia", cellannotation))
 Idents(lin.list$Epithelia) <- "cellannotation"
 
 ## Endothelia
@@ -100,8 +107,8 @@ cluster.ids <- c("0" = "venous endothelia",
                  "1" = "venous endothelia",
                  "2" = "venous endothelia",
                  "3" = "venous endothelia",
-                 "4" = "capillary endothelia",
-                 "5" = "arterial endothelia",
+                 "4" = "arterial endothelia",
+                 "5" = "capillary endothelia",
                  "6" = "lymphatic endothelia",
                  "7" = "venous endothelia")
 lin.list$Endothelia <- RenameIdents(lin.list$Endothelia, cluster.ids) %>%
@@ -109,8 +116,8 @@ lin.list$Endothelia <- RenameIdents(lin.list$Endothelia, cluster.ids) %>%
 
 ## Leukocytes
 Idents(lin.list$Leukocyte) <- "RNA_snn_res.0.4"
-cluster.ids <- c("0" = "macrophage",
-                 "1" = "T cell",
+cluster.ids <- c("0" = "T cell",
+                 "1" = "macrophage",
                  "2" = "NK cell",
                  "3" = "mast cell",
                  "4" = "B cell",
@@ -120,9 +127,9 @@ lin.list$Leukocyte <- RenameIdents(lin.list$Leukocyte, cluster.ids) %>%
 
 ## Stroma
 Idents(lin.list$Stroma) <- "RNA_snn_res.1"
-cluster.ids <- c("0" = "smooth muscle cell",
+cluster.ids <- c("0" = "minor interstitial fibroblast",
                  "1" = "pericyte",
-                 "2" = "minor interstiital fibroblast",
+                 "2" = "smooth muscle cell",
                  "3" = "major interstitial fibroblast",
                  "4" = "smooth muscle cell",
                  "5" = "smooth muscle cell",
@@ -131,12 +138,11 @@ cluster.ids <- c("0" = "smooth muscle cell",
                  "8" = "periepithelial fibroblast of urethra",
                  "9" = "smooth muscle cell",
                  "10" = "endoneurial fibroblast",
-                 "11" = "glial cell",
+                 "11" = "satellite glial cell",
                  "12" = "pericyte",
-                 "13" = "major interstitial fibroblast",
-                 "14" = "pericyte",
-                 "15" = "smooth muscle cell",
-                 "16" = "glial cell")
+                 "13" = "pericyte",
+                 "14" = "smooth muscle cell",
+                 "15" = "satellite glial cell")
 lin.list$Stroma <- RenameIdents(lin.list$Stroma, cluster.ids) %>%
   StashIdent("cellannotation")
 
@@ -152,7 +158,7 @@ plotdir <- paste0(outdir, "dot_plots/")
 dir.create(plotdir, showWarnings=FALSE)
 
 gene.list <- list(
-  "Epithelia" = strsplit("AKR1C1 AKR1C2 MKI67 TOP2A PIGR LCN2 KRT6A CHGA KRT5 BCAM", split=" ")[[1]],
+  "Epithelia" = strsplit("AKR1C1 AKR1C2 MKI67 TOP2A PIGR LCN2 KRT6A CHGA KRT5 BCAM JUN FOS", split=" ")[[1]],
   "Endothelia" = strsplit("LYVE1 EFNB2 ACKR1 TXNIP VWF", split=" ")[[1]],
   "Leukocyte" = strsplit("LYVE1 C1QA CD163 PTPRC IL7R CD8A GZMK HLA-DRA KIT MS4A1 CD79A JCHAIN GNLY GZMB", split = " ")[[1]],
   "Stroma" = strsplit("C7 SFRP4 STC1 APOE APOD NGFR THY1 CD36 DES ACTG2 PRUNE2 MCAM BCAM RGS5 DLK1 MYF5 CDH19 GPM6B", split = " ")[[1]]
-- 
GitLab