clusterProfiler
#BiocManager::install('clusterProfiler')
#BiocManager::install("pathview")
#install.packages('tidyverse')
library(clusterProfiler)
library(tidyverse)
data1<-read.table("K2.txt",header = TRUE,row.names = 1)
#head(data1)
data1.2<-data1 %>% select_if(is.numeric)
data1.2$Group <- factor(data1$Group,levels=c("CCFM16","Placebo"))
#write.csv(data1.2,"data1.2.csv")
#summary(data1.2)
'''
shapiro.test的零假设是变量符合正态分布,
当结果的p-value > 0.05时,不能拒绝原假设,表明变量服从正态分布
dim(data1)
diff_test <- data1 %>% 
    select_if(is.numeric) 
shapiro.test(diff_test[,1])
Shapiro-Wilk normality test
data:  diff_test[, 1]
W = 0.97972, p-value = 0.297
'''
##  符合正态分布,则进行t-test
diff <- data1.2 %>% 
  select_if(is.numeric) %>%
  map_df(~ broom::tidy(t.test(. ~ Group,data = data1.2)), .id = 'var')
#整合数据
diff$q.value <- p.adjust(diff$p.value,"fdr")
diff$FC<-diff$estimate1/diff$estimate2
diff$logFC<-log2(diff$FC)
p1<-diff[,c(1,14,6)]
newdata1<-na.omit(p1)
#newdata2  <- filter(newdata1, newdata$logFC!= Inf)
#newdata3  <- filter(newdata2, newdata$logFC = Inf)
p2 <- p1[p1$logFC!= "-Inf",]
p3 <- p2[p2$logFC!= "Inf",]
write.csv(newdata3,"p1.csv")
#diff <- diff %>% filter(p.value < 0.05)
##################UP###############
flt <- p3[p3$logFC > 1.1 & p3$p.value < 0.05,]
up_gene<-na.omit(flt)
library("pathview")
library(clusterProfiler)
ekegg <- enrichKEGG(gene =up_gene$var,
                    organism = "ko",
                    keyType = "kegg")
View(as.data.frame(ekegg))              
dotplot(ekegg)
#browseKEGG(ekegg, "rno05146")
barplot(ekegg, showCategory = 20)
dotplot(ekegg, x = "GeneRatio",
        color = "p.adjust", 
        showCategory = 30, 
        split = NULL, font.size = 12,)
browseKEGG(ekegg, "ko02025")
#################down##########
flt <- p3[p3$logFC < 1.1 & p3$p.value < 0.05,]
down_gene<-na.omit(flt)
library("pathview")
library(clusterProfiler)
ekegg <- enrichKEGG(gene =down_gene$var,
                    organism = "ko",
                    keyType = "kegg")
View(as.data.frame(ekegg))              
dotplot(ekegg)
dotplot(ekegg, x = "GeneRatio",
        color = "p.adjust", 
        showCategory = 30, 
        split = NULL, font.size = 12,)
browseKEGG(ekegg, "ko00720")
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇