-
Notifications
You must be signed in to change notification settings - Fork 1
/
step7-deg-by-anything.R
55 lines (43 loc) · 1.51 KB
/
step7-deg-by-anything.R
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
rm(list = ls())
library(Seurat)
# devtools::install_github('satijalab/seurat-data')
library(SeuratData)
library(ggplot2)
library(patchwork)
library(dplyr)
load(file = 'basic.sce.pbmc.Rdata')
DimPlot(pbmc, reduction = 'umap',
label = TRUE, pt.size = 0.5) + NoLegend()
sce=pbmc
sce.markers <- FindAllMarkers(object = sce, only.pos = TRUE,
min.pct = 0.25,
thresh.use = 0.25)
DT::datatable(sce.markers)
save(sce.markers,file = 'sce.markers.all_10_celltype.Rdata')
load(file = 'sce.markers.all_10_celltype.Rdata')
head(sce.markers)
table(sce.markers$cluster)
kp=grepl('Mono',sce.markers$cluster)
table(kp)
cg_sce.markers = sce.markers [ kp ,]
DoHeatmap(sce,unique(cg_sce.markers$gene),size=3)
levels(Idents(sce))
markers_df <- FindMarkers(object = sce,
ident.1 = 'FCGR3A+ Mono',
ident.2 = 'CD14+ Mono',
#logfc.threshold = 0,
min.pct = 0.25)
DoHeatmap(sce,unique(rownames(markers_df)),size=3)
intersect( rownames(markers_df) ,
cg_sce.markers$gene)
# drop-out
highCells= colnames(subset(x = sce, subset = FCGR3A > 1,
slot = 'counts'))
highORlow=ifelse(colnames(sce) %in% highCells,'high','low')
table(highORlow)
[email protected]$highORlow=highORlow
markers <- FindMarkers(sce, ident.1 = "high",
group.by = 'highORlow' )
head(x = markers)
intersect( rownames(markers_df) ,
rownames(markers) )