http://www.bioconductor.org/packages/release/bioc/vignettes/SingleR/inst/doc/SingleR.html
https://zhuanlan.zhihu.com/p/497286137
http://www.reibang.com/p/1c4abf05cb3e?ivk_sa=1024320u
1. 可直接使用的數(shù)據(jù)格式
SingleCellExperiment
SummarizedExperiment
2. 獲得 SingleCellExperiment
數(shù)據(jù)格式
需要的R包:
Seurat
load("/home/zhiyong/Desktop/Feature_over_2000/Human_REP1_RPL35_KD_25uM_3_200_filtered_feature_over_2000.RData")
object_used <- Human_REP1_RPL35_KD_25uM_3_200_filtered_feature_over_2000
class(object_used)
pp <- as.SingleCellExperiment(object_used)
class(pp)
3. 獲得 SummarizedExperiment
數(shù)據(jù)格式
需要的R包:
SummarizedExperiment
4. 使用
require(Seurat)
require(scuttle)
require(SingleR)
'#-------------------------------------------------------------------------#
# Data for train
load("/home/zhiyong/Desktop/BBBBBBBB-Brain-ZYP/Reference/2017_Yi-Zhang_CR/Data/object_used.RData")
Train_data <- as.SingleCellExperiment(object_used)
Train_data@colData[["Label"]] <- as.character(Train_data$ident)
Train_data <- logNormCounts(Train_data)
#-------------------------------------------------------------------------#
# Data for test
load("/home/zhiyong/Desktop/BBBBBBBB-Brain-ZYP/Figure_1/C/Feature_number_cutoff/J20_1---used/HVF_2000_dim_6/Mouse_brain_J20_1__raw_3_200__Feature_over_500__HVF_2000_dim_6.RData")
Test_data <- as.SingleCellExperiment(Mouse_brain_J20_1__raw_3_200__Feature_over_500__HVF_2000_dim_6)
Test_data <- logNormCounts(Test_data)
#-------------------------------------------------------------------------#
# Annotation
Annotation_result <- SingleR(test=Test_data, ref=Train_data, labels=Train_data$Label, de.method="wilcox")
head(Annotation_result)
Mouse_brain_J20_1__raw_3_200__Feature_over_500__HVF_2000_dim_6@meta.data[["Celltype_from_SingleR"]] <- Annotation_result$pruned.labels
Note: 如果設(shè)置
clusters=
损拢,則會在 cluster 層面進行細胞類型的注釋;否則是在 細胞 層面