相关论文:J Adv Res. 2024 May 7:S2090-1232(24)00183-8.
library(scMetabolism)
library(tidyverse)
library(rsvd)
library(Seurat)
library(pheatmap)
library(ComplexHeatmap)
library(ggsci)
load(file = "pbmc_demo.rda")
countexp.Seurat@meta.data$celltype <- Idents(countexp.Seurat)
countexp.Seurat <- sc.metabolism.Seurat(obj = countexp.Seurat,
method = "VISION",
imputation = F, ncores = 2,
metabolism.type = "KEGG")
metabolism.matrix <- countexp.Seurat@assays$METABOLISM$score
metabolism.matrix
DimPlot.metabolism(obj = countexp.Seurat,
pathway = "Glycolysis / Gluconeogenesis",
dimention.reduction.type = "umap",
dimention.reduction.run = F, size = 1.5)
input.pathway <- rownames(countexp.Seurat"METABOLISM"]][["score"]])[1:30] [[
DotPlot.metabolism(obj = countexp.Seurat,
pathway = input.pathway,
phenotype = "celltype",
norm = "y")
input.pathway <- rownames(countexp.Seurat"METABOLISM"]][["score"]])[1:2] [[
BoxPlot.metabolism(obj = countexp.Seurat,
pathway = input.pathway,
phenotype = "celltype", ncol = 1)
sce_Metal_exp = countexp.Seurat
sce_Metal_exp$celltype = sce_Metal_exp$celltype
mscore_data = data.frame(t(sce_Metal_exp@assays[["METABOLISM"]][["score"]]),sce_Metal_exp$celltype)
avg_sM=aggregate(mscore_data[,1:ncol(mscore_data)-1],list(mscore_data$sce_Metal_exp.celltype),mean)
rownames(avg_sM) = avg_sM$Group.1
avg_sM=data.frame(t(avg_sM[,-1]))
avg_sM$KEGG = rownames(sce_Metal_exp@assays[["METABOLISM"]][["score"]])
rownames(avg_sM)=avg_sM$KEGG
c_k_l = c()
for(c in c(1:ncol(avg_sM))){
c_k=avg_sM[order(avg_sM[,c]),]$KEGG[1:5]
c_k_l=c(c_k_l,c_k)
}
c_k_l= unique(c_k_l)
c_k_d = avg_sM[avg_sM$KEGG %in%c_k_l,]
rownames(c_k_d) = c_k_d$KEGG
pheatmap::pheatmap(c_k_d[,-ncol(c_k_d)],show_colnames = T,scale='row')
吴博士开发的scMetabolism还是挺好的。不过,我们在用自己的数据进行分析时,有个小bug,就是需要把counts数写入RNA。这样就可以用于单细胞数据代谢分析了。当然,最好吴博有空修正下里面的小bug!期待ing~