install.packages('devtools')
library(devtools)
# scHCL requires ggplot2/reshape2/plotly/shiny/shinythemes/shiny
install_github("ggjlab/scHCL")
#示例数据
library(scHCL)
# hcl_lung is an example expression matrix from HCL project.
data(hcl_lung)
dim(hcl_lung)
#[1] 2884 80
## 2884 genes expression value of 80 cells
# scHCL has two parameters , single cell expression matrix(scdata) and
# the number of most similar cell types
hcl_result <- scHCL(scdata = hcl_lung, numbers_plot = 3)
以自己的seurat对象的分群来鉴定细胞类群
CM.mt<-cbind(as.data.frame(CM.mt@meta.data$seurat_clusters),as.matrix(t(GetAssayData(seurat.object,slot = "data"))))
colnames(CM.mt)[1]<-"cluster"
CM.mt<-aggregate(.~cluster,CM.mt,mean)
rownames(CM.mt)<-CM.mt$cluster
CM.mt<-CM.mt[,-1]
CM.mt<-t(CM.mt)
hcl_result <- scHCL(scdata = CM.mt, numbers_plot = 3)
head(hcl_result$scHCL_probility,15)