library(Seurat)
obj = readRDS(rds)
obj@assays$predictions@data[1:10,1:3]
###创建一个空矩阵
data = obj@assays$predictions@data
num = matrix(,nrow= length(rownames(data)),ncol = length(rownames(data)))
rownames(num) = rownames(data)
colnames(num) = rownames(data)
for (i in rownames(num)){
for (j in colnames(num)){
if (i != j){
num[i,j] = table(data[i,] > 0.1 & data[j,] > 0.1)[2]
}}}
num[is.na(num)] = 0
num
####抽取目标细胞,这里作为示例
num = num[1:10,1:10]
library(RColorBrewer)
library(corrplot)
corrplot(num, method = 'color',type = 'lower',is.corr = FALSE,col = colorRampPalette(brewer.pal(n = 9,name = 'Reds'))(100),cl.pos = 'r',cl.length = 5,col.lim = c(0,round(max(num,-2))))
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。