4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ggplot2でMA plot

Last updated at Posted at 2014-07-08

はじめに

MA plotは、x軸のAが平均、y軸のMが差。
MA plot - Wikipedia, the free encyclopedia

やってみた

EdgeRの出力結果の表を想定しています(遺伝子ごとに、a.value, m.value, estimatedDEGが記録されている)。
estimatedDEGは、1ならば発現変動遺伝子(DEG)を表します。下の例では、DEGの点だけを赤くします。

MAplot
g <- ggplot(res, aes(x=a.value, y=m.value, colour=factor(estimatedDEG))) +
geom_point(size=1) + 
scale_colour_manual(values = c("black", "red")) + 
scale_fill_manual(values = c("black", "red"), breaks=c("0", "1"), labels=c("non DEG", "DEG")) + 
theme(legend.title=element_blank()) + 
ggtitle(paste0(conditions[1], " vs ", conditions[coef]))
print(g)

さらに、DEGが何個あったかをプロットに追加します。

MAplot
g <- g + annotate("text", x = rep(max(res$a.value)*0.8, 2), y = c(0.8,0.9) * min(res$m.value), label = c(label1, label2))
print(g)
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?