library(GSVA)
setwd("F:\\pancancer lncRNA immune\\全体集合结果\\单样本富集分析")
data <- read.table("data_mrna.txt",stringsAsFactors = F)
duiying <- read.table("ENSG-Gene symbol.txt",stringsAsFactors = F,sep = "\t")
weizhi <- match(rownames(data),duiying[,2])
data <- as.matrix(data)
rownames(data) <- duiying[weizhi,1]
gs <- read.csv("immune.csv",stringsAsFactors = F,row.names = 1)
gs <- t(gs)
gs <- as.data.frame(gs)
gs <- as.list(gs)
gs <- lapply(gs, function(x) x[which(x != "")])
jieguo <- gsva(data,gs, method = "ssgsea", ssgsea.norm = TRUE, verbose = TRUE)
#write.csv(jieguo,"immune_ssGSEA.csv",quote = F)