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")
cond_marker <- c("Cd3e", "Cd8a", "Cd4")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 | 9 | 18 | |||
| 1 | 10 | 19 | |||
| 2 | 11 | 20 | |||
| 3 | 12 | 21 | |||
| 4 | 13 | 22 | |||
| 5 | 14 | 23 | |||
| 6 | 15 | 24 | |||
| 7 | 16 | ||||
| 8 | 17 |
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()