Commit 73467876 authored by Matteo Barcella's avatar Matteo Barcella
Browse files

Adding scripts for reproducing images 2C to 2G

parent f6fb9139
# script for figures 2C,D,E,F
## loading libraries
library(Seurat)
library(ggplot2)
library(ggplotify)
library(ggraph)
library(ggrepel)
library(ggpubr)
library(ComplexHeatmap)
library(gridExtra)
library(RColorBrewer)
library(dittoSeq)
library(openxlsx)
library(reshape2)
library(ggalluvial)
library(dplyr)
# load seurat object
obj <- readRDS("CultureDataset.rds")
# setting color palette:
colpalette <- c("#A6CEE3","#B2DF8A","#FDBF6F","#E78AC3","#FFFF99","#E31A1C","darkgrey")
## Figure 2C
pdf(file = "Fig2C.pdf", width = 4, height = 4)
dittoSeq::dittoDimPlot(object = obj, reduction.use = "umap.harmony.orig.ident",
var = "Population", opacity = 0.6, do.label = T,labels.size = 5,
labels.highlight = F, labels.repel = T, size = 0.6) +
scale_color_manual(values = colpalette) +
theme(legend.position = "none", plot.title = element_blank(),
axis.text = element_text(size = 16, color = "black"))
dev.off()
## Figure 2D
pdf(file = "Fig2D.pdf",
width = 4, height = 4)
ggplot(data = g, aes(x = Sample, y = Frequency, alluvium = Population)) +
geom_alluvium(aes(fill = Population),
alpha = .5, decreasing = FALSE, width = 1/4) +
geom_stratum(aes(stratum = Population, fill = Population), alpha = .50, decreasing = FALSE, width = 1/4) +
scale_fill_manual(values = alpha(colour = colpalette, alpha = 0.50)) +
theme_void() +
theme(legend.position = "none",
plot.title = element_blank(),
axis.title = element_blank(),
panel.background = element_rect(fill = "white"),
axis.text = element_text(size = 16, color = "black"))
dev.off()
## Figure 2E
obj_sorted <- subset(obj, cells = WhichCells(object = obj, expression = orig.ident %in% c("S10","S11","S12")))
obj_sorted$Sorting <- obj_sorted$orig.ident
obj_sorted$Sorting <- gsub(x = obj_sorted$Sorting, pattern = "S10", replacement = "CD38-")
obj_sorted$Sorting <- gsub(x = obj_sorted$Sorting, pattern = "S11", replacement = "GMP")
obj_sorted$Sorting <- gsub(x = obj_sorted$Sorting, pattern = "S12", replacement = "MEP")
obj_sorted$Sorting <- factor(obj_sorted$Sorting, levels = c("CD38-","GMP","MEP"))
cols_sorted <- list("CD38-" = "#008744",
"GMP" = "#0057e7",
"MEP" = "#d62d20"
)
obj_sorted <- SetIdent(obj_sorted, value = "Sorting")
obj_sorted$sortcol <- cols_sorted$`CD38-`
obj_sorted$sortcol[which(obj_sorted$Sorting == "GMP")] <- cols_sorted$GMP
obj_sorted$sortcol[which(obj_sorted$Sorting == "MEP")] <- cols_sorted$MEP
p <- dittoDimPlot(object = obj_sorted, var = "Sorting",
color.panel = cols_sorted,
show.others = T,split.nrow = 1,
split.by = "Sorting",
labels.highlight = F,labels.repel = T,
contour.color = "darkgrey",
labels.size = 3.5,do.contour = T,contour.linetype = 2,
reduction.use = "umap.harmony.orig.ident", size = 0.5,
do.label = F) +
theme(legend.position = "none",
legend.key.size = unit(x = 0.1, units = "in"),
strip.background.x = element_rect(fill = "white"),
strip.text.x.bottom = element_text(size = 12),
plot.title = element_blank(),
axis.title = element_blank(),
axis.text = element_text(size = 12),
panel.border = element_rect())
pdf("Fig2E.pdf", width = 6, height = 2.5)
p
dev.off()
## Figure 2F
pdf(file = "Fig2F.pdf", width = 4, height = 4)
ggplot(data = g, aes(x = Sample, y = Frequency, fill = Population)) +
geom_bar(stat = "identity", width = 0.5, color = "black") +
scale_fill_manual(values = alpha(colour = colpalette, alpha = 0.50)) +
theme_void() +
theme(legend.position = "none",
plot.title = element_blank(),
axis.title = element_blank(),
panel.background = element_rect(fill = "white"),
axis.text = element_text(size = 16, color = "black"))
dev.off()
# script for figures 2G
## loading libraries
library(Seurat)
library(ggplot2)
library(ggplotify)
library(ggraph)
library(ggrepel)
library(ggpubr)
library(ComplexHeatmap)
library(gridExtra)
library(RColorBrewer)
library(dittoSeq)
library(openxlsx)
library(reshape2)
library(ggalluvial)
library(dplyr)
# load seurat object
obj <- readRDS("CultureDataset.rds")
obj <- subset(obj, cells = WhichCells(object = obj,expression = orig.ident %in% c("C04","C02","C03")))
obj <- SetIdent(object = obj, value = "Population")
citokine_dotplot_C04_C02_C03 <- DotPlot(object = obj,
features = c("KIT","MPL","FLT3","IL6R","IL3RA"),
dot.min = 0.05,
scale.by = "size") +
labs(color = "ZscoreExpr", size = "PctExpr") +
scale_color_gradient2(low = "blue", mid = "lightgrey", high = "red") +
theme(axis.title = element_blank(),
legend.position = "none", # Places the legend at the bottom
legend.justification = "left", # Justifies the legend to the left
legend.box = "vertical"
) +
scale_x_discrete(guide = guide_axis(n.dodge = 2))
pdf(file = "Fig2G.pdf", width = 3, height = 4)
citokine_dotplot_C04_C02_C03
dev.off()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment