生信小白的福利,利用quanTIseq算法進行免疫浸潤分析
小云又來分享啦!今天小云為小伙伴帶來的分享為利用quanTIseq算法進行免疫浸潤分析,然后基于亞型分組信息文件,進行亞型間免疫細(xì)胞含量顯著差異分析,該分析在腫瘤生信文章中必備的分析內(nèi)容,非常值得小伙伴學(xué)習(xí),小云強烈推薦呀!接下來跟著小云開啟開始今天的分享學(xué)習(xí)。
1.?quanTIseq算法介紹
在進行該分析之前,小云先簡單介紹一下quanTIseq算法,quanTIseq基于反卷積算法,利用bulk samples的RNA_seq數(shù)據(jù),可以對腫瘤樣本中不同種類免疫細(xì)胞的組成進行預(yù)測,支持10種類型的免疫細(xì)胞,包括B cells,Classically activated macrophages (M1),Alternatively activated macrophages (M2),Monocytes,Neutrophils,Natural killer (NK) cells,Non-regulatory CD4+ T cells ,CD8+ T cells,Dendritic cells,Other uncharacterized cells,這就是小云對該算法的介紹,想深入學(xué)習(xí)的小伙伴可以到該網(wǎng)址:https://icbi.i-med.ac.at/software/quantiseq/doc/index.html#Figure1。
#首先下載quanTIseq流程分析腳本,如下文:
wget https://icbi.i-med.ac.at/software/quantiseq/doc/downloads/quanTIseq_pipeline.sh
#quanTIseq流程運行參數(shù)使用方法

2.?準(zhǔn)備需要的R包
#安裝需要的包
install.packages("ggplot2")
install.packages("ggsci")
install.packages("tidyverse")
install.packages("reshape2")
install.packages("ggpubr")
#加載需要的R包
library(reshape2)
library(ggpubr)
library(ggplot2)
library(tidyverse)
library(ggsci)
3.輸入數(shù)據(jù)
#EXP.txt,基因表達矩陣文件,行名為基因名,列名為樣本信息。
exp<-read.table("EXP.txt",header=T,row.names=1,sep="\t",check.names=F)

#將行名轉(zhuǎn)化為列名
exp<-rownames_to_column(exp,var="GENE")
4.利用quanTIseq算法進行免疫浸潤分析
#quanTIseq進行免疫浸潤分析
bash quanTIseq_pipeline.sh --inputfile=exp.txt --outputdir=quanTIseqTest --prefix=quanTIseqTest --pipelinestart=decon
input表示基因表達矩陣,第一列為基因名,其他列為樣本名。
outputdir表示生成結(jié)果文件名
prefix表示生成結(jié)果文件前綴
pipelinestart表示quanTIseq分析流程,基因表達矩陣選用decon
#生成結(jié)果文件為quanTIseqTest_cell_fractions.txt,該結(jié)果為計算的10種免疫細(xì)胞在不同樣本中的含量,第一列為樣本名,其他列為免疫細(xì)胞類型。

5.不同亞型中quanTIseq算法計算的免疫細(xì)胞的顯著差異分析
#讀取quanTIseq分析免疫細(xì)胞組成結(jié)果文件
immune<-read.table("quanTIseqTest_cell_fractions.txt",header=T,sep="\t")
#將Sample列”.”修改為”-”
immune$Sample<-str_replace_all(immune$Sample,"\\.","-")
#亞型分組文件,行名為樣本信息,第一列為樣本信息,第二列為亞型分組信息。
K3<-read.table("K3.txt",header=T,sep="\t")

#合并免疫細(xì)胞組成文件和亞型分組文件
final<-left_join(immune,K3,by=”Sample”)
#長寬數(shù)據(jù)轉(zhuǎn)換
quanTIseq_cluster<-melt(final,id.vars=c("Sample","Cluster"))
#設(shè)置列名
colnames(quanTIseq_cluster)<-c("Sample","Cluster","celltype","quanTIseq")
#繪制顯著差異分析小提琴+箱線圖
boxplot_quanTIseq<- ggplot(quanTIseq_cluster, aes(x = celltype, y =quanTIseq?))+
??labs(y="quanTIseq",x= "")+ ?
??geom_boxplot(aes(fill = Cluster),position=position_dodge(0.5),width=0.5)+
??scale_fill_npg()+
??#修改主題
theme_classic() +
???theme(axis.title = element_text(size = 12,color ="black"),
???????????????????axis.text = element_text(size= 12,color = "black"),
???????????????????panel.grid.minor.y = element_blank(),
???????????????????panel.grid.minor.x = element_blank(),
???????????????????axis.text.x = element_text(angle = 45, hjust = 1 ),
???????????????????panel.grid=element_blank(),
???????????????????legend.position = "top",
???????????????????legend.text = element_text(size= 12),
???????????????????legend.title= element_text(size= 12)
??) +
??stat_compare_means(aes(group = ?Cluster),
?????????????????????label = "p.signif",
?????????????????????method = "kruskal.test",#kruskal.test多組檢驗
?????????????????????hide.ns = F)#隱藏不顯著的
#保存圖片
ggsave(file="quanTIseq.pdf",boxplot_quanTIseq,height=10,width=15)

最終小云成功的對不同亞型利用quanTIseq算法進行了免疫浸潤分析,,看起來圖片效果非常不錯,歡迎大家和小云一起討論學(xué)習(xí)呀!

