1. 准备感兴趣基因集(genelist)并进行适当格式转换
setwd("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap")
list <- read.csv("zonghe.csv")
genes_V1<- as.vector(list[,1])
View(genes_V1)
library("clusterProfiler")
library("org.Mm.eg.db")
genes_V2 <- bitr(genes_V1,
fromType = "SYMBOL",
toType = "ENSEMBL",
OrgDb = org.Mm.eg.db)
library("biomaRt")
chicken = useMart("ensembl", dataset = "ggallus_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")
mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")
human = useMart("ensembl", dataset = "hsapiens_gene_ensembl", host = "https://dec2021.archive.ensembl.org/")
genes_V3 = getLDS(attributes = c("ensembl_gene_id"),
filters = "ensembl_gene_id",
values = genes_V2$ENSEMBL,
mart = mouse,
attributesL = c("ensembl_gene_id"),
martL = chicken,
uniqueRows=T)
library("org.Gg.eg.db")
genes_V4 <- bitr(genes_V3$Gene.stable.ID.1,
fromType = "ENSEMBL",
toType = "SYMBOL",
OrgDb = org.Gg.eg.db)
View(genes_V2)
View(genes_V3)
View(genes_V4)
write.table(genes_V4, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/T_cell_pathway_genes.txt", row.names = FALSE)
2. 对各样本的FPKM值进行整理
rm(list=ls())
getwd()
setwd("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/")
A1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/A1_FRAS220122137.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
A2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/A2_FRAS220122138.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
A3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/A3_FRAS220122139.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
B1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/B1_FRAS220122140.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
B2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/B2_FRAS220122141.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
B3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/B3_FRAS220122142.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
H1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/H1_FRAS220122143.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
H2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/H2_FRAS220122144.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
H3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/H3_FRAS220122145.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
I1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/I1_FRAS220122146.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
I2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/I2_FRAS220122147.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
I3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/I3_FRAS220122148.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
J1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/J1_FRAS220122149.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
J2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/J2_FRAS220122150.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
J3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/J3_FRAS220122151.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
K1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/K1_FRAS220122152.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
K2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/K2_FRAS220122153.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
K3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/K3_FRAS220122154.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
L1.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/L1_FRAS220122155.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
L2.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/L2_FRAS220122156.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
L3.gene.tab <- read.table("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/gene_tab/L3_FRAS220122157.gene.tab", header = TRUE, sep = "\t" , quote = "\"")
A1.FPKM <- A1.gene.tab[,c(1,8)]
A2.FPKM <- A2.gene.tab[,c(1,8)]
A3.FPKM <- A3.gene.tab[,c(1,8)]
B1.FPKM <- B1.gene.tab[,c(1,8)]
B2.FPKM <- B2.gene.tab[,c(1,8)]
B3.FPKM <- B3.gene.tab[,c(1,8)]
H1.FPKM <- H1.gene.tab[,c(1,8)]
H2.FPKM <- H2.gene.tab[,c(1,8)]
H3.FPKM <- H3.gene.tab[,c(1,8)]
I1.FPKM <- I1.gene.tab[,c(1,8)]
I2.FPKM <- I2.gene.tab[,c(1,8)]
I3.FPKM <- I3.gene.tab[,c(1,8)]
J1.FPKM <- J1.gene.tab[,c(1,8)]
J2.FPKM <- J2.gene.tab[,c(1,8)]
J3.FPKM <- J3.gene.tab[,c(1,8)]
K1.FPKM <- K1.gene.tab[,c(1,8)]
K2.FPKM <- K2.gene.tab[,c(1,8)]
K3.FPKM <- K3.gene.tab[,c(1,8)]
L1.FPKM <- L1.gene.tab[,c(1,8)]
L2.FPKM <- L2.gene.tab[,c(1,8)]
L3.FPKM <- L3.gene.tab[,c(1,8)]
colnames(A1.FPKM)[2] <-"A1"
colnames(A2.FPKM)[2] <-"A2"
colnames(A3.FPKM)[2] <-"A3"
colnames(B1.FPKM)[2] <-"B1"
colnames(B2.FPKM)[2] <-"B2"
colnames(B3.FPKM)[2] <-"B3"
colnames(H1.FPKM)[2] <-"H1"
colnames(H2.FPKM)[2] <-"H2"
colnames(H3.FPKM)[2] <-"H3"
colnames(I1.FPKM)[2] <-"I1"
colnames(I2.FPKM)[2] <-"I2"
colnames(I3.FPKM)[2] <-"I3"
colnames(J1.FPKM)[2] <-"J1"
colnames(J2.FPKM)[2] <-"J2"
colnames(J3.FPKM)[2] <-"J3"
colnames(K1.FPKM)[2] <-"K1"
colnames(K2.FPKM)[2] <-"K2"
colnames(K3.FPKM)[2] <-"K3"
colnames(L1.FPKM)[2] <-"L1"
colnames(L2.FPKM)[2] <-"L2"
colnames(L3.FPKM)[2] <-"L3"
write.table(A1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/A1.FPKM.txt", row.names = FALSE)
write.table(A2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/A2.FPKM.txt", row.names = FALSE)
write.table(A3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/A3.FPKM.txt", row.names = FALSE)
write.table(B1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/B1.FPKM.txt", row.names = FALSE)
write.table(B2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/B2.FPKM.txt", row.names = FALSE)
write.table(B3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/B3.FPKM.txt", row.names = FALSE)
write.table(H1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/H1.FPKM.txt", row.names = FALSE)
write.table(H2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/H2.FPKM.txt", row.names = FALSE)
write.table(H3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/H3.FPKM.txt", row.names = FALSE)
write.table(I1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/I1.FPKM.txt", row.names = FALSE)
write.table(I2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/I2.FPKM.txt", row.names = FALSE)
write.table(I3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/I3.FPKM.txt", row.names = FALSE)
write.table(J1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/J1.FPKM.txt", row.names = FALSE)
write.table(J2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/J2.FPKM.txt", row.names = FALSE)
write.table(J3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/J3.FPKM.txt", row.names = FALSE)
write.table(K1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/K1.FPKM.txt", row.names = FALSE)
write.table(K2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/K2.FPKM.txt", row.names = FALSE)
write.table(K3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/K3.FPKM.txt", row.names = FALSE)
write.table(L1.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/L1.FPKM.txt", row.names = FALSE)
write.table(L2.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/L2.FPKM.txt", row.names = FALSE)
write.table(L3.FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/L3.FPKM.txt", row.names = FALSE)
setwd("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap")
genes_V5 <- read.csv("group_zonghe.txt")
Interesting_pathway <- group_6_zonghe
A1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, A1.FPKM$Gene.ID))
A2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, A2.FPKM$Gene.ID))
A3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, A3.FPKM$Gene.ID))
B1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, B1.FPKM$Gene.ID))
B2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, B2.FPKM$Gene.ID))
B3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, B3.FPKM$Gene.ID))
H1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, H1.FPKM$Gene.ID))
H2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, H2.FPKM$Gene.ID))
H3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, H3.FPKM$Gene.ID))
I1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, I1.FPKM$Gene.ID))
I2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, I2.FPKM$Gene.ID))
I3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, I3.FPKM$Gene.ID))
J1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, J1.FPKM$Gene.ID))
J2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, J2.FPKM$Gene.ID))
J3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, J3.FPKM$Gene.ID))
K1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, K1.FPKM$Gene.ID))
K2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, K2.FPKM$Gene.ID))
K3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, K3.FPKM$Gene.ID))
L1_Interesting_pathway_row.NO <- c(match(Interesting_pathway, L1.FPKM$Gene.ID))
L2_Interesting_pathway_row.NO <- c(match(Interesting_pathway, L2.FPKM$Gene.ID))
L3_Interesting_pathway_row.NO <- c(match(Interesting_pathway, L3.FPKM$Gene.ID))
A1_Interesting_pathway_gene_FPKM <- na.omit(A1.FPKM[A1_Interesting_pathway_row.NO ,])
A2_Interesting_pathway_gene_FPKM <- na.omit(A2.FPKM[A2_Interesting_pathway_row.NO ,])
A3_Interesting_pathway_gene_FPKM <- na.omit(A3.FPKM[A3_Interesting_pathway_row.NO ,])
B1_Interesting_pathway_gene_FPKM <- na.omit(B1.FPKM[B1_Interesting_pathway_row.NO ,])
B2_Interesting_pathway_gene_FPKM <- na.omit(B2.FPKM[B2_Interesting_pathway_row.NO ,])
B3_Interesting_pathway_gene_FPKM <- na.omit(B3.FPKM[B3_Interesting_pathway_row.NO ,])
H1_Interesting_pathway_gene_FPKM <- na.omit(H1.FPKM[H1_Interesting_pathway_row.NO ,])
H2_Interesting_pathway_gene_FPKM <- na.omit(H2.FPKM[H2_Interesting_pathway_row.NO ,])
H3_Interesting_pathway_gene_FPKM <- na.omit(H3.FPKM[H3_Interesting_pathway_row.NO ,])
I1_Interesting_pathway_gene_FPKM <- na.omit(I1.FPKM[I1_Interesting_pathway_row.NO ,])
I2_Interesting_pathway_gene_FPKM <- na.omit(I2.FPKM[I2_Interesting_pathway_row.NO ,])
I3_Interesting_pathway_gene_FPKM <- na.omit(I3.FPKM[I3_Interesting_pathway_row.NO ,])
J1_Interesting_pathway_gene_FPKM <- na.omit(J1.FPKM[J1_Interesting_pathway_row.NO ,])
J2_Interesting_pathway_gene_FPKM <- na.omit(J2.FPKM[J2_Interesting_pathway_row.NO ,])
J3_Interesting_pathway_gene_FPKM <- na.omit(J3.FPKM[J3_Interesting_pathway_row.NO ,])
K1_Interesting_pathway_gene_FPKM <- na.omit(K1.FPKM[K1_Interesting_pathway_row.NO ,])
K2_Interesting_pathway_gene_FPKM <- na.omit(K2.FPKM[K2_Interesting_pathway_row.NO ,])
K3_Interesting_pathway_gene_FPKM <- na.omit(K3.FPKM[K3_Interesting_pathway_row.NO ,])
L1_Interesting_pathway_gene_FPKM <- na.omit(L1.FPKM[L1_Interesting_pathway_row.NO ,])
L2_Interesting_pathway_gene_FPKM <- na.omit(L2.FPKM[L2_Interesting_pathway_row.NO ,])
L3_Interesting_pathway_gene_FPKM <- na.omit(L3.FPKM[L3_Interesting_pathway_row.NO ,])
Interesting_pathway_gene_FPKM_A <- merge(A1_Interesting_pathway_gene_FPKM, merge(A2_Interesting_pathway_gene_FPKM, A3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_B <- merge(B1_Interesting_pathway_gene_FPKM, merge(B2_Interesting_pathway_gene_FPKM, B3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_H <- merge(H1_Interesting_pathway_gene_FPKM, merge(H2_Interesting_pathway_gene_FPKM, H3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_I <- merge(I1_Interesting_pathway_gene_FPKM, merge(I2_Interesting_pathway_gene_FPKM, I3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_J <- merge(J1_Interesting_pathway_gene_FPKM, merge(J2_Interesting_pathway_gene_FPKM, J3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_K <- merge(K1_Interesting_pathway_gene_FPKM, merge(K2_Interesting_pathway_gene_FPKM, K3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM_L <- merge(L1_Interesting_pathway_gene_FPKM, merge(L2_Interesting_pathway_gene_FPKM, L3_Interesting_pathway_gene_FPKM,by="Gene.ID"),by="Gene.ID")
Interesting_pathway_gene_FPKM <- merge(merge(merge(Interesting_pathway_gene_FPKM_A, merge(Interesting_pathway_gene_FPKM_B, Interesting_pathway_gene_FPKM_H,by="Gene.ID"),by="Gene.ID"), merge(Interesting_pathway_gene_FPKM_I, merge(Interesting_pathway_gene_FPKM_J, Interesting_pathway_gene_FPKM_K,by="Gene.ID"),by="Gene.ID"),by="Gene.ID"), Interesting_pathway_gene_FPKM_L,by="Gene.ID")
View(Interesting_pathway_gene_FPKM)
write.table(Interesting_pathway_gene_FPKM, file = "E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/Interesting_FPKM.txt", row.names = FALSE)
3. 利用R包pheatmap对各样本的FPKM值进行绘图
rm(list=ls())
getwd()
setwd("E:/Rstudio/xieruyu/RNA-seq/2022-07-28/Rtreatment/heatmap/")
library(RColorBrewer)
library(pheatmap)
cc = colorRampPalette(rev(brewer.pal(n=7, name="RdYlBu")))
T_cell_pathway<-read.table(file = "T_cell_pathway_FPKM.txt",row.names = 1,header = T,check.names = F)
T_cell_pathway=log2(T_cell_pathway+1)
heatmap=pheatmap(T_cell_pathway,color = cc(1000),
main=" ",
fontsize = 15,
scale="row",
border_color = NA,
na_col = "grey",
cluster_rows = F,cluster_cols = F,
show_rownames = T,show_colnames = T,
treeheight_row = 30,treeheight_col = 30,
cellheight = 15,cellwidth = 30,
cutree_row=2,cutree_col=2,
display_numbers = F,legend = T,
filename = "T_cell_pathway.tiff")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)