R2-38 火山图

jinhui 2017-12-19 20:24:22 阅读: 1040

library(ggplot2)

mytheme <- theme_classic() +

  theme(panel.grid = element_blank(),  

        legend.position = "no",            

        plot.caption = element_text(face = "bold.italic"), 

        panel.border=element_rect(fill='transparent', color='black'))

graph1 <- ggplot(mtcars, aes(factor(cyl))) + 

  geom_bar(aes(fill = factor(gear)), width = 0.6) + 

  labs(title = "R2-38", subtitle = "subtitle", caption = "caption", x = "cyl", fill = "gear") + 

  mytheme


library(latex2exp)

setwd("D:/projects/R learning/week 7 data")

myvolcano <- read.csv("nature23643-s4.csv")  

myvolcano$significant <- as.factor(ifelse(-log2(myvolcano$q_value)>5,

                                ifelse(abs(log2(myvolcano$FC)) >1,"yes" ,"not"),"not"))

data <- read.csv("nature23643-s4.csv") 

mytheme=theme_bw()+theme(panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line(colour = "black"),legend.position = "none")


data$id=a$锘縂ene.ID


data$q_value=-log2(data$q_value)


data$FC=log2(data$FC)


data$threshold=as.factor(ifelse(data$q_value>5,ifelse(abs(data$FC)>1,"yes","not"),"not"))


yes=subset(data,data$threshold == "yes")


not=subset(data,data$threshold == "not")


p = ggplot()+geom_point(data=not,aes(x=FC,y=q_value),color="grey")+geom_point(data=yes,aes(x=FC , y = q_value,color=id),size=2)+xlim(-3,3)+geom_text(data=yes,aes(x=FC,y=q_value,label=yes$id),size = 3, hjust=0,vjust=-1)+geom_vline(xintercept =0,lty=4,col="black")+labs(x = expression(paste(log[2],"(fold change)")),y = expression(paste(-log[2],"(Q value)")))+annotate("segment", x = 1 , xend = 2.5, y= -0.5, yend=-0.5, color = "black", size = 0.5,arrow = arrow(angle = 18,ends = "last",type = "closed"))+annotate("segment", x = -1 , xend = -2.5,  y= -0.5, yend=-0.5, color = "black",size = 0.5,arrow = arrow(angle = 18,ends = "last",type = "closed")) +annotate("text",x = 1.7,y=0.5,label = "Upregulated",size = 4.5) +annotate("text",x = -1.7,y=0.5, label = "Downregulated",size = 4.5)


p+mytheme+ggtitle("R2-38")


1.png


2.png



 
邀请讨论

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
{{item.nick_name}} 受邀请回答 {{item.create_time}}
{{item.refer_comment.nick_name}} {{item.refer_comment.create_time}}

附件

{{f.title}} 大小 {{f.file_size}} 下载 {{f.count_download}} 金币 {{f.count_gold}}
切换到完整回复 发送回复
赞({{item.count_zan}}) 踩({{item.count_cai}}) 删除 回复 关闭
科研狗©2015-2024 科研好助手,京ICP备20005780号-1 建议意见

服务热线

178 0020 3020

微信服务号