> randomColor <- function() {
paste0("#",paste0(sample(c(0:9, letters[1:6]), 6, replace = TRUE),collapse = ""))
}
> randomColors <- replicate(100,randomColor())
> seurat=readRDS("seurat.rds")
##标准化LogNormalize
> seurat <- NormalizeData(seurat, normalization.method = "LogNormalize", scale.factor = 10000)
## 鉴定高变基因
> seurat <- FindVariableFeatures(seurat, selection.method = "vst", nfeatures = 2000)
# 提取前10的高变基因
> top10 <- head(VariableFeatures(seurat), 10)
# 展示高变基因
> pdf("高变基因.pdf")
> VariableFeaturePlot(seurat)
> dev.off()
> pdf("标记前10高变基因.pdf")
> LabelPoints(plot = VariableFeaturePlot(seurat), points = top10, repel = TRUE)
> dev.off()
#保存数据
> saveRDS(seurat,"seurat1.rds")
只供学习交流