-
Notifications
You must be signed in to change notification settings - Fork 133
/
AUCell_intro.Rmd
139 lines (66 loc) · 1.45 KB
/
AUCell_intro.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
80
81
82
83
84
85
86
87
88
---
title: "R Notebook"
output: html_notebook
---
```{r}
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("AUCell")
```
```{r}
library(AUCell)
library(Seurat)
```
```{r}
load("droplet_Lung_seurat_tiss.Robj")
tiss <- UpdateSeuratObject(object = tiss)
```
```{r}
tiss[[]]
```
```{r}
DimPlot(object = tiss, group.by = "cell_ontology_class", label = TRUE)
```
```{r}
markers <- read.csv("PanglaoDB_markers_27_Mar_2020.tsv", sep = "\t")
markers <- markers[markers$cell.type == "Endothelial cells" & markers$species != "Hs",]
markers
```
```{r}
genes <- markers$official.gene.symbol
mousify <- function(a){
return(paste0(substr(a,1,1), tolower(substr(a,2,nchar(a)))))
}
genes <- sapply(genes, mousify)
genes
```
```{r}
counts <- GetAssayData(object = tiss, slot = "counts")
```
```{r}
cell_rankings <- AUCell_buildRankings(counts)
```
```{r}
cells_AUC <- AUCell_calcAUC(genes, cell_rankings)
```
```{r}
cells_assignment <- AUCell_exploreThresholds(cells_AUC, plotHist = TRUE, assign=TRUE)
```
```{r}
cells_assignment$geneSet$assignment
```
```{r}
new_cells <- names(which(getAUC(cells_AUC)["geneSet",]>0.15))
```
```{r}
tiss$is_ec <- ifelse(colnames(tiss) %in% new_cells, "EC", "non_EC")
```
```{r}
tiss[[]]
```
```{r}
DimPlot(object = tiss, group.by = "is_ec", label = TRUE)
```
```{r}
DimPlot(object = tiss, group.by = "cell_ontology_class", label = TRUE)
```