More than 5 years have passed since last update.
はじめに
CummeRbundは,Cufflinksによって発現量を推定した結果を可視化するためのRパッケージです.
詳しくはマニュアルをご覧ください.図が多いので分かりやすいと思います.
CummeRbundには,複数条件下での遺伝子発現の結果を綺麗に可視化する関数が予め用意されています(expressionPlotやexpressionBarplot).
複数の遺伝子に対してこれらの関数を単純に適用させると,一つの図に複数の遺伝子発現のプロットが描画されます.
同時に見たい遺伝子が少数で,かつ,発現量(FPKM)のスケールが同じくらいであればこれでよいのですが,通常は比較したい遺伝子(機能グループ,パラログなど)の発現量のスケールは様々である場合が多いため,不便です.
そこで,CummeRbundで遺伝子発現のプロットを遺伝子ごとに並べる方法を考えました.
ここでは,CummeRbundがggplot2を内部で使用していることを利用しています.
やってみた
準備
# インストールsource("http://bioconductor.org/biocLite.R")biocLite("cummeRbund")# パッケージのロードlibrary("cummeRbund")# (hoge にCufflinks/Cuffdiffの結果の入ったディレクトリ名を指定)cuff<-readCufflinks("hoge")# geneids にベクトルとして格納されている遺伝子IDと一致する結果を取り出すmyGenes<-getGenes(cuff,geneids)expressionPlot
折れ線グラフです.
通常のexpressionPlot
p<-expressionPlot(myGenes)print(p)遺伝子ごとにexpressionPlotを並べる
p<-expressionPlot(myGenes)+facet_wrap(~tracking_id,scales="free_y")+theme(legend.position="none",axis.text.x=element_text(size=6,angle=90),strip.text=element_text(size=4))print(p)expressionBarplot
棒グラフです.
通常のexpressionBarplot
p<-expressionBarplot(myGenes)print(p)遺伝子ごとにexpressionBarplotを並べる
p<-expressionBarplot(myGenes,logMode=F)+facet_wrap(~tracking_id,scales="free")+theme(axis.text.x=element_text(angle=0,hjust=1))print(p)参考
Bioconductor Code Search
expressionPlotがどのようにggplot2を使っているかがわかります.
Summer 2010 — R: ggplot2 Intro
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
