-
Notifications
You must be signed in to change notification settings - Fork 0
/
05_UMAPs_Frequency_plot.Rmd
50 lines (40 loc) · 1.27 KB
/
05_UMAPs_Frequency_plot.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "UMAPs + Frequency plots + Violins"
output:
html_document:
toc: true
toc_float: true
toc_depth: 2
---
```{r}
source("src/00_library.R")
seu <- readRDS(paste0(dirs["rds"],"seu_corrected_clean.RDS"))
DefaultAssay(seu) <- "RNA"
# Define some variables to plot figures
variables <- c("seurat_clusters", "sample", "condition", "treatment")
features <- c("percent.mt", "nFeature_RNA", "nCount_RNA",
"CD3E", "CD3D", "CD19", "NCAM1", "ITGAX", "CD14",
"HLA-DRA", "HLA-DRB1","IL3RA")
# UMAPs
```{r}
for(variable in variables) {
print(DimPlot(seu, reduction = "umap", group.by = variable, label = TRUE) +
scale_color_manual(values=colors[[variable]][unique([email protected][[variable]])]))
}
```
# Frequency plots
```{r frequencies, echo=FALSE}
plot_freq_plot(seu$seurat_clusters, seu$condition,
legend = "seurat_clusters", x_lab = "condition",
palette = cluster_colors)
```
# Feature plots
```{r feature-plots, echo=FALSE, out.width=c("50%", "50%")}
for(feature in features) {
if(isTRUE(feature %in% rownames(seu)) || isTRUE(feature %in% names([email protected]))) {
print(FeaturePlot(seu, reduction = "umap", features = c(feature)))
} else {
print(paste(feature, "not expressed in dataset."))
}
}
```