cibersortx怎么用_Cibersort实战

rm(list=ls())

load(file='../Rdata/@step3_DEG_LN.Rdata')

# exprSet=new_exprSet

# phe

# differentiation=pheno$`his type:ch1`,T_stage= pheno$`depth:ch1`,

# N_stage=pheno$`lymph node metastasis:ch1`)

# phe

# phe

# phe

phe$N_stage

exprSet

dim(exprSet)

colnames(phe)

# exprSet

exprSet

# exprSet[1:5,1:5]

match(colnames(exprSet),phe$GSM_ID)

##### 基因如果存在一些数字开头的名字 可能会出错

# exprSet

#### 如果实在不行就只提取500个基因进行计算

# ##### cibersort 计算只需要500多个基因就可以了。

# LM22

# exprSet

# write.table(exprSet,file = '../Rdata/for_cibersort_mitrix.txt',sep = '\t',quote=FALSE)

###### 输入结果后作图

library(reshape2)

library(ggthemes)

library(ggpubr)

library("scales")

cibersort_result

colnames(cibersort_result)

match(cibersort_result$Input.Sample,phe$GSM_ID)

cibersort_result

### 只挑选一部分细胞

cibersort_result

gene_name

exprSet

cibersort_result$groupquantile(exprSet[gene_name,],0.5),'High','Low')

cibersort_result_L

library(ggplot2)

library(stringr)

p=ggplot(cibersort_result_L,aes(x=TILs,y=value,fill=group))+geom_boxplot()+

stat_compare_means(method = "wilcox.test",label="p.signif")

# scale_x_discrete(labels=colnames(cibersort_result))+

# theme(axis.title = element_text(,angle = 45,hjust = .5, vjust = .5))

print(p)

ggsave('../figure/TILs_ggplot.pdf', p)

ggplot(cibersort_result_L,aes(group,value,fill=TILs,colour = TILs))+

geom_bar(stat="identity",position="fill")+

ggtitle("LM22")+

theme_classic()+

xlab(gene_name)+

scale_fill_manual(values=c("#999999", "#E69F00", "#56B4E9","black","red","chocolate","deeppink","darkmagenta",

"#000000", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7",'green','#FFB6C1',

'#DC143C','#DDA0DD','#800080','#6A5ACD','#87CEEB','#BDB76B','#FF4500'))+

scale_colour_manual(values=c("#999999", "#E69F00", "#56B4E9","black","red","chocolate","deeppink","darkmagenta",

"#000000", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7",'green','#FFB6C1',

'#DC143C','#DDA0DD','#800080','#6A5ACD','#87CEEB','#BDB76B','#FF4500'))

你可能感兴趣的:(cibersortx怎么用)