-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathiBlastoids_integration.Rmd
More file actions
107 lines (78 loc) · 3.74 KB
/
Copy pathiBlastoids_integration.Rmd
File metadata and controls
107 lines (78 loc) · 3.74 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
title: "iBlastoids_integration"
author: "jibsch"
date: "2021-01-23"
output: workflowr::wflow_html
editor_options:
chunk_output_type: inline
---
## Integrate all data
```{r}
seurat_d6 = readRDS("../output/seurat_iblastoids.Rds")
seurat_pet3 = readRDS("../output/seurat_pet3.Rds")
blake = readRDS("../output/blake.Rds")
```
### Remove NR and Integrate
```{r}
seurat_d6_noNR = seurat_iblastoids[,seurat_iblastoids$celltype!="NR_iBlastoids"]
blast.list = list("iBlast" = seurat_d6_noNR, "blake" = blake, "pet" = seurat_pet3 )
blast.features <- SelectIntegrationFeatures(object.list = blast.list, nfeatures = 4000)
blast.list <- PrepSCTIntegration(object.list = blast.list, anchor.features = blast.features,
verbose = FALSE)
```
```{r}
blast.anchors <- FindIntegrationAnchors(object.list = blast.list, normalization.method = "SCT",
anchor.features = blast.features, verbose = FALSE, dims = 1:14,
k.filter = 29, k.score = 29)
blast.integrated_d6_blake_pet_noNR <- IntegrateData(anchorset = blast.anchors, normalization.method = "SCT",
verbose = FALSE)
```
```{r}
blast.integrated_d6_blake_pet_noNR = RunPCA(blast.integrated_d6_blake_pet_noNR, verbose = FALSE)
DimPlot(blast.integrated_d6_blake_pet_noNR, reduction = "pca", group.by = "orig.ident")
blast.integrated_d6_blake_pet_noNR = RunUMAP(blast.integrated_d6_blake_pet_noNR, dims=1:20)
DimPlot(blast.integrated_d6_blake_pet_noNR, reduction = "umap", group.by = "orig.ident")
DimPlot(blast.integrated_d6_blake_pet_noNR, reduction = "umap", group.by = "celltype", label = TRUE) ->p1
DimPlot(blast.integrated_d6_blake_pet_noNR, reduction = "umap", group.by = "group", label = TRUE) ->p2
CombinePlots(list(p1,p2))
```
```{r}
blast.integrated_d6_blake_pet_noNR$original_id =
factor(ifelse(blast.integrated_d6_blake_pet_noNR$orig.ident == "iBlastoids",
#as.character(blast.integrated_d6_blake_pet$cell_type),
as.character(blast.integrated_d6_blake_pet_noNR$celltype),
as.character(blast.integrated_d6_blake_pet_noNR$group %>% gsub("Epi", "EPI",.))))
n = blast.integrated_d6_blake_pet_noNR$original_id
blast.integrated_d6_blake_pet_noNR$type = ifelse(grepl("pre",n), "Pre_Blast",
ifelse(grepl("TE", n), "TE",
ifelse(grepl("PE", n), "PE",
ifelse(grepl("EPI",n), "EPI", "IM"))))
```
```{r}
blast.integrated_d6_blake_pet_noNR = FindNeighbors(blast.integrated_d6_blake_pet_noNR, dims = 1:20)
blast.integrated_d6_blake_pet_noNR = FindClusters(blast.integrated_d6_blake_pet_noNR, resolution = 0.2)
DimPlot(blast.integrated_d6_blake_pet_noNR, label = TRUE)
```
```{r}
blast.integrated_d6_blake_pet_noNR$cluster_int = factor(recode(blast.integrated_d6_blake_pet_noNR$seurat_clusters,
"2" = "Int_EPI", "1" = "Int_PE", "0" = "Int_TE",
"3" = "Int_IM1", "4" = "Int_IM2"), levels =
c("Int_EPI", "Int_TE", "Int_PE", "Int_IM1",
"Int_IM2"))
```
```{r}
blast.integrated_d6_blake_pet_noNR = AddModuleScore(blast.integrated_d6_blake_pet_noNR, features = petro_sig.list[c("ALL-PE", "ALL-TE", "ALL-PE")], name = c("EPI", "TE", "PE"))
names([email protected]) = gsub("[123]$","", names([email protected]))
```
```{r}
[email protected] = [email protected][,c("orig.ident", "seurat_clusters", "original_id", "cluster_int", "EPI", "TE", "PE")]
```
```{r}
blast.integrated_d6_blake_pet_noNR$type =
ifelse(grepl("EPI", blast.integrated_d6_blake_pet_noNR$original_id),
"EPI",
ifelse(grepl("TE", blast.integrated_d6_blake_pet_noNR$original_id),
"TE",
ifelse(grepl("PE", blast.integrated_d6_blake_pet_noNR$original_id),
"PE","IM")))
```