使用SC3聚类

1.SC3

https://bioconductor.org/packages/release/bioc/html/SC3.html

https://bioconductor.org/packages/release/bioc/vignettes/SC3/inst/doc/SC3.html#run-sc3

dim(rna)#18666  1047

# create a SingleCellExperiment object
sce <- SingleCellExperiment(
  assays = list(
    counts = as.matrix(rna),#计数槽用于基因过滤,这是基于基因dropout率
    logcounts = log2(as.matrix(rna) + 1)
    #主聚类算法采用Logcounts槽,该槽既包含归一化的表达式矩阵,又包含log-transform的表达式矩阵。
  )
)
dim(sce)#18666  1047

# define feature names in feature_symbol column
rowData(sce)$feature_symbol <- rownames(sce)
# remove features with duplicated names  去除重复特征
sce <- sce[!duplicated(rowData(sce)$feature_symbol), ]

sce <- sc3(sce, ks = 4:4, biology = TRUE)

sc3_interactive(sce)#运行很慢,无法在新窗口显示结果
sc3_export_results_xls(sce)
sce <- runPCA(sce)
col_data <- colData(sce)
head(col_data[ , grep("sc3_", colnames(col_data))])
plotPCA(
  sce, 
  colour_by = "sc3_4_clusters", 
  size_by = "sc3_4_log2_outlier_score"
)
plotPCA(
  sce, 
  colour_by = "sc3_4_clusters"
)

 

posted @ 2021-06-20 19:35  lypbendlf  阅读(300)  评论(0编辑  收藏  举报