library(dplyr)
library(tidyr)
library(ggplot2)
library(pheatmap)
library(patchwork)
library(Seurat)
library(stringr)
library(ggthemes)
#library(SingleCellExperiment)
library(gridExtra)
library(ggrepel)vis_LEC_tumor_skin
Visualize expression across different conditions (LECs in tumor and skin)
The experiment consist of 3 main factors of interest:
sample origin: tumor, skin, lymph node
main cell type class: leucocytes, LECs
tumor type: YUMM, YUMMER
As a first check we are interested in the expression of specific marker genes/known marker and how they vary across combinations of these factors.
Preamble
Data objects
From the FGCZ we have different data objects:
Tumor LECs integrated (only tumor LECs, but have been integrated with skin samples) (
data/scData_LEC_tumor.rds)Tumor + skin LECs integrated (
data/scData_LEC_tumor_skin.rds)All skin + tumor cells
All lymphnode cells
Here we work with object 2 - Integrated tumor and skin LECs.
#### ----- change to local path to scData.rds object here ----- #####
# e.g. seurat <- readRDS("/home/project/data_folder/scData.rds)")
seurat<- readRDS(file.path("/Users/thomarin/Documents/PhD/Tumor project/Sequencing experiment/August 2023 first analysis shallow sequencing/rds file/scData_tumor_CD45.rds"))
#### --------------------------------------------------------- #####
# correct condition assignment!!
seurat$cond <- seurat[[]] |>
mutate(
cond = case_when(
str_detect(Sample, "YUMM[0-9]") ~ "YUMM",
str_detect(Sample, "YUMMER") ~ "YUMMER",
str_detect(Sample, "Skin") ~ "skin"
)
) |> select(cond)
# check assignment
table(seurat$Sample, seurat$cond)
skin YUMM YUMMER
SkinLECs_Leukocytes1 1510 0 0
SkinLECs_Leukocytes2 2351 0 0
TumorYUMM1_1A 0 664 0
TumorYUMM1_1B 0 586 0
TumorYUMM2_1A 0 1886 0
TumorYUMM2_1B 0 1652 0
TumorYUMM5_2A 0 1829 0
TumorYUMM5_2B 0 1603 0
TumorYUMM6_2A 0 2380 0
TumorYUMM6_2B 0 2267 0
TumorYUMMER3_1A 0 0 1031
TumorYUMMER3_1B 0 0 887
TumorYUMMER4_1A 0 0 1442
TumorYUMMER4_1B 0 0 1234
TumorYUMMER7_2A 0 0 2015
TumorYUMMER7_2B 0 0 1898
TumorYUMMER8_2A 0 0 2593
TumorYUMMER8_2B 0 0 2379
table(seurat$cond)
skin YUMM YUMMER
3861 12867 13479
DefaultAssay(seurat) <- "SCT"
cluster_marker <- c("Cd3e", "Cd8a", "Cd4" ,"Tcf7", "Lef1", "Pdcd1", "Sell", "Tigit", "Cxcr4", "Ccr7", "Foxp3", "Ctla4", "Trdc", "Il12b", "Itgae", "Xcr1", "Cd207", "Notch2", "Itgax", "Itgam", "Il1a", "Cd80", "Cd19", "Prox1", "Pecam1", "Csf2rb", "Csf3r", "Il1r2", "Acta2", "Pdgfrb", "Ctsk", "Cd74", "H2-Ab1", "H2-Aa", "Krt15", "Krt5", "Cd79a", "Ccl3", "Ccl4")
cond_marker <- c("Cd3e", "Cd8a", "Cd4", "Tcf7", "Lef1", "Pdcd1", "Foxp3")Overview
Distribution of conditions per cluster
cond_dat <- seurat[[]] |> group_by(cond, ident) |> summarise(n_cells = n())`summarise()` has grouped output by 'cond'. You can override using the
`.groups` argument.
ggplot(cond_dat, aes(fill=cond, y=n_cells, x=ident)) +
geom_bar(position="stack", stat="identity") +
scale_fill_tableau() +
theme_bw()ggplot(cond_dat, aes(fill=cond, y=n_cells, x=ident)) +
geom_bar(position="fill", stat="identity") +
scale_fill_tableau() +
theme_bw()Distribution of cells within umap
DimPlot(seurat, group.by = "ident", split.by = "cond", reduction = "umap") + ggtitle("")#Almut please put number of clusters inside the plotCluster marker gene expression
| Cluster | Genes | Cluster | Genes | Cluster | Genes |
| 0 - Monocytes/ Macrophages |
Cxcr4, Notch2, Itgax, Csf2rb, Il1r2 | 9 - LECs | Prox1, Pecam1 | 18 | Cxcr4, Il1a, CD80, Csf3r, Il1r2 |
| 1 - Monocytes/ Macrophages |
Cxcr4, Notch2, Itgam | 10 - Tregs | Cd3e, Cd4, Sell, Tigit, FoxP3, Ctla4 | 19 DCs | Cd74, H2-Ab1, H2-Aa |
| 2 - Granulocytes | Notch2, Itgax, CD80, Csf2rb, Il1r2 | 11 - TGD | Cd3e, Tcf7, Trdc | 20 -Keratinocytes | Krt15, Krt5 |
| 3 - TGD | Tcf7, Lef1, Sell, Tigit, Trdc | 12 | CCR7, Il12b, CD80, Csf2rb | 21 - B cells | CD19, Cd79a |
| 4 - cDC2 | Notch2, Itgam | 13 Fibroblasts | acta2, Pdgfrb | 22 | Itgax |
| 5 - Macrophages | Notch2, Itgax, Itgam, Csf2rb | 14 | Notch2, Csf2rb | 23 | Tcf7, Trdc |
| 6 - Monocytes | Itgam | 15 | Tcf7, Cxcr4, | 24 | Ccl3, Ccl4 |
| 7 - exhausted CD8 T cells | Cd3e, Cd8a, Pdcd1 | 16 | Cd3e, Cd8a, Tcf7, Pdcd1, Ctla4 | ||
| 8 - LECs | Notch2, Prox1, Pecam1 | 17 | Ctsk |
Dimplots
FeaturePlot(object = seurat, features = cluster_marker, ncol = 3)Violinplots
VlnPlot(object = seurat, features = cluster_marker, ncol = 3, assay = "SCT", add.noise = F)Dotplots
DotPlot(object = seurat, features = cluster_marker) +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))Conditional marker expression
Expression by condition as Dimplot
FeaturePlot(object = seurat, features = cond_marker, ncol = 3, split.by = "cond")Expression as violin plot grouped by cluster
VlnPlot(object = seurat,
features = cond_marker,
assay = "SCT",
add.noise = F,
split.by = "cond",
ncol = 1) +
plot_layout(guides = 'collect') &
scale_fill_tableau() &
theme_bw()Expression as violin plot grouped by cluster
VlnPlot(object = seurat,
features = cond_marker,
group.by = "cond",
assay = "SCT",
add.noise = F,
ncol = 2) +
plot_layout(guides = 'collect') &
scale_fill_tableau() &
theme_bw()# Subset your Seurat object to only include cells from cluster 7
cluster7_seurat <- subset(seurat, idents = 7)
# Create the violin plot for cluster 7
VlnPlot(object = cluster7_seurat,
features = cond_marker,
group.by = "cond",
assay = "SCT",
add.noise = FALSE,
ncol = 2) +
plot_layout(guides = 'collect') +
scale_fill_tableau() +
theme_bw()# Subset your Seurat object to only include cells from cluster 7
clusters_comined <- c(3,11)
cluster3_11_seurat <- subset(seurat, idents = clusters_comined)
# Create the violin plot for cluster 7
VlnPlot(object = cluster3_11_seurat,
features = cond_marker,
group.by = "cond",
assay = "SCT",
add.noise = FALSE,
ncol = 2) +
plot_layout(guides = 'collect') +
scale_fill_tableau() +
theme_bw()