基于Seurat包对标签进行修改

基于Seurat包对标签进行修改便于绘制图片和进行分析

mydata <- RunPCA(mydata, assay = "SCT", verbose = FALSE)
mydata <- FindNeighbors(mydata, reduction = "pca", dims = 1:30)
mydata <- FindClusters(mydata, verbose = FALSE)
mydata <- RunUMAP(mydata, reduction = "pca", dims = 1:30)
p1 <- DimPlot(mydata, reduction = "umap", label = TRUE)
p2 <- SpatialDimPlot(mydata, label = TRUE, label.size = 3)
plot_grid(p1, p2)





a=c(1)
for (i in 1:1200) {
  a[i]=1
}
for (i in 1201:2438) {
  a[i]=2
}
length(a)
mydata@meta.data$testk<-a
p1 <- DimPlot(mydata, reduction = "umap", group.by = "testk")
p2 <- SpatialDimPlot(mydata, group.by = "testk", label.size = 3)
plot_grid(p1, p2)



你可能感兴趣的:(数据挖掘,r语言)