-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostProcess.Rmd
104 lines (65 loc) · 3.93 KB
/
postProcess.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
```{r}
library(Seurat)
#library(SeuratDisk)
library(ggplot2)
library(patchwork)
```
# Explore the mapping + ref_query results
```{r}
sample <- readRDS('/Volumes/klavine/Active/Junedh/COVID_PBMC/azimuth/ref_query/refquery.rds')
```
```{r}
Idents(sample) <- 'id'
sample_query <- subset(sample, idents=c("query"))
sample_ref <- subset(sample, idents=c("reference"))
```
```{r}
DimPlot(sample_query, group.by = "id", label.size = 3, repel = TRUE)
DimPlot(sample_ref, group.by = "id", label.size = 3, repel = TRUE)
```
```{r}
DimPlot(sample_query, group.by = "predicted.celltype.l1", label = TRUE, label.size = 3, repel = TRUE)
DimPlot(sample_query, group.by = "predicted.celltype.l2", label = TRUE, label.size = 3, repel = TRUE) + NoLegend()
DimPlot(sample_ref, group.by = "celltype.l2", label = TRUE, label.size = 3, repel = TRUE) + NoLegend()
```
# Filter out the erythrocytes, doublets
```{r}
DimPlot(sample_query, group.by = "predicted.celltype.l2", label = TRUE, label.size = 3, repel = TRUE) + NoLegend()
```
```{r}
Idents(object=sample_query) <- "predicted.celltype.l2"
sample_subset <- subset(sample_query, idents = c("CD14 Mono", "CD16 Mono", "CD4 TCM", "CD8 TEM", "MAIT", "CD4 CTL", "NK", "NK Proliferating", "Treg", "CD4 Naive", "B naive", "CD4 TEM", "gdT", "B intermediate", "pDC", "B memory", "NK_CD56bright", "CD8 Naive", "HSPC", "Plasmablast", "CD8 TCM", "CD4 Proliferating", "cDC1", "dnT", "cDC2", "ILC", "CD8 Proliferating", "ASDC", "Platelet"))
```
```{r}
DimPlot(sample_subset, group.by = "predicted.celltype.l1", label = TRUE, label.size = 3 ,repel = TRUE)
DimPlot(sample_subset, group.by = "predicted.celltype.l2", label = TRUE, label.size = 3 ,repel = TRUE) + NoLegend()
DimPlot(sample_subset, group.by = "sampleID", label.size = 3, repel = TRUE)
DimPlot(sample_subset, group.by = "condition", label.size = 3, repel = TRUE)
DimPlot(sample_subset, group.by = "diseaseStatus", label.size = 3, repel = TRUE)
```
```{r}
write.csv(sample_subset@meta.data, file = "/Volumes/klavine/Active/Junedh/COVID_PBMC/azimuth/ref_query/cleaned_withPlatelets_query_meta.csv", quote = FALSE)
saveRDS(sample_subset, file = "/Volumes/klavine/Active/Junedh/COVID_PBMC/azimuth/ref_query/cleaned_withPlatelets_query.rds")
```
### Look at the Mapping version of the UMAP
```{r}
sample_mapped <- readRDS('/Volumes/klavine/Active/Junedh/COVID_PBMC/azimuth/merged_azimuth_mapped.rds')
```
```{r}
DimPlot(sample_mapped, reduction = "ref.umap", group.by = "predicted.celltype.l1", label = TRUE, label.size = 3 ,repel = TRUE)
DimPlot(sample_mapped, reduction = "ref.umap", group.by = "predicted.celltype.l2", label = TRUE, label.size = 3 ,repel = TRUE) + NoLegend()
DimPlot(sample_mapped, reduction = "ref.umap", group.by = "sampleID", label.size = 3, repel = TRUE)
DimPlot(sample_mapped, reduction = "ref.umap", group.by = "condition", label.size = 3, repel = TRUE)
DimPlot(sample_mapped, reduction = "ref.umap", group.by = "diseaseStatus", label.size = 3, repel = TRUE)
```
```{r}
Idents(object=sample_mapped) <- "predicted.celltype.l2"
sample_subset <- subset(sample_mapped, idents = c("CD14 Mono", "CD16 Mono", "CD4 TCM", "CD8 TEM", "MAIT", "CD4 CTL", "NK", "NK Proliferating", "Treg", "CD4 Naive", "B naive", "CD4 TEM", "gdT", "B intermediate", "pDC", "B memory", "NK_CD56bright", "CD8 Naive", "HSPC", "Plasmablast", "CD8 TCM", "CD4 Proliferating", "cDC1", "dnT", "cDC2", "ILC", "CD8 Proliferating", "ASDC"))
```
```{r}
DimPlot(sample_subset, reduction = "ref.umap", group.by = "predicted.celltype.l1", label = TRUE, label.size = 3 ,repel = TRUE)
DimPlot(sample_subset, reduction = "ref.umap", group.by = "predicted.celltype.l2", label = TRUE, label.size = 3 ,repel = TRUE) + NoLegend()
DimPlot(sample_subset, reduction = "ref.umap", group.by = "sampleID", label.size = 3, repel = TRUE)
DimPlot(sample_subset, reduction = "ref.umap", group.by = "condition", label.size = 3, repel = TRUE)
DimPlot(sample_subset, reduction = "ref.umap", group.by = "diseaseStatus", label.size = 3, repel = TRUE)
```