library('Seurat')
## Loading required package: SeuratObject
## Loading required package: sp
## 'SeuratObject' was built under R 4.3.2 but the current version is
## 4.3.3; it is recomended that you reinstall 'SeuratObject' as the ABI
## for R may have changed
## 'SeuratObject' was built with package 'Matrix' 1.6.4 but the current
## version is 1.6.5; it is recomended that you reinstall 'SeuratObject' as
## the ABI for 'Matrix' may have changed
##
## Attaching package: 'SeuratObject'
## The following object is masked from 'package:base':
##
## intersect
library('ggplot2')
library('plyr')
library('dplyr')
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library('viridis')
## Loading required package: viridisLite
library('scCustomize')
## scCustomize v2.1.2
## If you find the scCustomize useful please cite.
## See 'samuel-marsh.github.io/scCustomize/articles/FAQ.html' for citation info.
library('ggthemes')
library('plotly')
##
## Attaching package: 'plotly'
## The following objects are masked from 'package:plyr':
##
## arrange, mutate, rename, summarise
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library('cowplot')
##
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggthemes':
##
## theme_map
LMN_Final = readRDS("LMN_Final_MB_Seurat5.rds")
#Verification of cluster
Idents(LMN_Final) <- "seurat_clusters"
DimPlot(LMN_Final, reduction = "umap", label = FALSE, pt.size = 1, label.size = 0,
group.by = "injury.status", alpha = 0.2, split.by = "injury.status", cols = c("#EB984E",
"#7FB3D5"), order = FALSE) + NoLegend() + NoAxes()
ggsave("Figure_1_B.png", height = 4, width = 8, dpi = 300, units = "in")
DimPlot(LMN_Final, reduction = "umap", label = FALSE, pt.size = 1, label.size = 0,
group.by = "injury.status", alpha = 0.2, cols = c("#EB984E", "#7FB3D5"), order = FALSE) +
NoLegend() + NoAxes()
#Verification of cluster and the marker genes
library(RColorBrewer)
# Define the number of colors you need
n <- 40 # Adjust based on your requirement
LMN_Final_DotPlot2 = read.csv("LMN_Final_Dotplot2.csv")
pal <- brewer.pal(n, "Spectral")
## Warning in brewer.pal(n, "Spectral"): n too large, allowed maximum for palette Spectral is 11
## Returning the palette you asked for with that many colors
pal_inverted <- rev(pal)
Idents(LMN_Final) <- "manual.clusters.2"
DotPlot_scCustom(LMN_Final, features = LMN_Final_DotPlot2$Marker, dot.scale = 6,
dot.min = 0.01, colors_use = pal_inverted) + theme(axis.text.x = element_text(angle = 90,
hjust = 1), axis.text = element_text(size = 15))
## Warning: Removed 141 rows containing missing values or values outside the scale range
## (`geom_point()`).
DimPlot_scCustom(seurat_object = LMN_Final, figure_plot = TRUE, label = T)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
Idents(LMN_Final) <- "manual.clusters.1"
DotPlot_scCustom(LMN_Final, features = LMN_Final_DotPlot2$Marker, dot.scale = 6,
dot.min = 0.01, colors_use = pal_inverted) + theme(axis.text.x = element_text(angle = 90,
hjust = 1), axis.text = element_text(size = 15))
## Warning: Removed 422 rows containing missing values or values outside the scale range
## (`geom_point()`).
DimPlot_scCustom(seurat_object = LMN_Final, figure_plot = TRUE, label = T)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
#DEG analysis
Idents(LMN_Final) <- "manual.clusters.2"
LMN_Final <- JoinLayers(LMN_Final)
LMN_CST_InjVUninj <- FindMarkers(LMN_Final,
subset.ident = "CST",
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_CST_InjVUninj,
file = "LMN_CST_InjvUninj.csv",
quote = FALSE)
LMN_HYP_InjVUninj <- FindMarkers(LMN_Final,
subset.ident = "HYP",
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_HYP_InjVUninj,
file = "LMN_HYP_InjvUninj.csv",
quote = FALSE)
LMN_RN_InjVUninj <- FindMarkers(LMN_Final,
subset.ident = "RN",
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_RN_InjVUninj,
file = "LMN_RN_InjvUninj.csv",
quote = FALSE)
LMN_DP_InjVUninj <- FindMarkers(LMN_Final,
subset.ident = "DP",
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_DP_InjVUninj,
file = "LMN_DP_InjvUninj.csv",
quote = FALSE)
LMN_MED_InjVUninj <- FindMarkers(LMN_Final,
subset.ident = "MED",
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_MED_InjVUninj,
file = "LMN_MED_InjvUninj.csv",
quote = FALSE)
LMN_ALL_InjVUninj <- FindMarkers(LMN_Final,
group.by = "injury.status",
ident.1 = "injured",
ident.2 = "uninjured",
logfc.threshold = 0,
min.pct = 0.01)
write.csv(x = LMN_ALL_InjVUninj,
file = "LMN_ALL_InjvUninj.csv",
quote = FALSE)