ScType 用的好像比较少,就两篇教程。
ScType 数据库:单细胞自动化注释工具 - 简书 (jianshu.com)
全方位讲解单细胞自动化注释工具
本来是有网站的,上不去。 https://sctype.app
只有github IanevskiAleksandr/sc-type (github.com)
这个注释方法和singleR一样简单,代码如下:
### sctpye注释
install.packages("HGNChelper")
# load libraries and functions #加载三个包
lapply(c("dplyr","Seurat","HGNChelper","openxlsx"), library, character.only = T)
#加载写好的代码
# load gene set preparation function
source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/gene_sets_prepare.R")
# load cell type annotation function
source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/sctype_score_.R")
#加载参考基因集ScTypeDB_short.xlsx,提取其中的Immune system
db_ = "https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/ScTypeDB_full.xlsx";
tissue = "Immune system"
gs_list = gene_sets_prepare(db_, tissue)
gs_list
#细胞类型中阳性和阴性标记基因
gs_list$gs_positive
gs_list$gs_negative
###用读取rds的方法会报错
#load example scRNA-seq matrix
#scRNAseqData = readRDS(file = "./scRNA1_20230414.rds")
#注释
#es.max = sctype_score(scRNAseqData = scRNAseqData, scaled = TRUE, gs = gs_list$gs_positive, gs2 = gs_list$gs_negative)
Error in dimnames(x) <- dn : 'dimnames' applied to non-array
In addition: Warning message:
In sctype_score(scRNAseqData = scRNAseqData, scaled = TRUE, gs = gs_list$gs_positive, :
Error in dimnames(x) <- dn : 'dimnames' applied to non-array
#注释
es.max = sctype_score(scRNAseqData = scRNA1[["RNA"]]@scale.data, scaled = TRUE,
gs = gs_list$gs_positive, gs2 = gs_list$gs_negative)
View(es.max)
# merge by cluster
cL_resutls = do.call("rbind", lapply(unique(scRNA1@meta.data$seurat_clusters), function(cl){
es.max.cl = sort(rowSums(es.max[ ,rownames(scRNA1@meta.data[scRNA1@meta.data$seurat_clusters==cl, ])]), decreasing = !0)
head(data.frame(cluster = cl, type = names(es.max.cl), scores = es.max.cl, ncells = sum(scRNA1@meta.data$seurat_clusters==cl)), 10)
}))
sctype_scores = cL_resutls %>% group_by(cluster) %>% top_n(n = 1, wt = scores)
sctype_scores
write.csv(sctype_scores, "./celltype_anno_sctypeR20230417.csv")
这是做出的注释:
cluster type
0 CD8+ NKT-like cells
1 Memory CD4+ T cells
2 CD8+ NKT-like cells
3 Classical Monocytes
4 Natural killer cells
5 Naive CD4+ T cells
6 γδ-T cells
7 Macrophages
8 CD4+ NKT-like cells
9 Pre-B cells
10 Non-classical monocytes
11 Endothelial
12 Naive CD4+ T cells
13 Erythroid-like and erythroid precursor cells
14 Naive B cells
15 Platelets
16 Cancer cells
17 HSC/MPP cells
18 Neutrophils
19 Non-classical monocytes
20 Progenitor cells
此数据为PBMC,看来注释的也是不靠谱,没比sigleR的fine注释强到那里去。也就做个参考,还是以main注释为基础,慢慢找marker 比较靠谱。
网友评论