LoginSignup
1
1

More than 3 years have passed since last update.

Agilent MicroArray(1色法)解析備忘録2

Last updated at Posted at 2019-04-26

グラフ作る

データフレーム化

1列目が遺伝子名、2列目が発現量の平均、3列目以降が各群の発現量とします。
そして最終列に比較したい群間の発現量の差を置きます。

coe <- fit$coefficients
gene <- fit$genes$GeneName
ame <- fit$Amean

x <- cbind(cbind(gene,ame),coe)
x <- as.data.frame(x)
for (i in 2:ncol(x)){
x[,i] <- as.numeric(as.character(x[,i]))
}
x$contrast <- x$KO-x$WT

散布図

黒一色

xlim=c(0,20)
ylim=c(-5,5)
plot(x[,2],x[,ncol(x)],col="black",
     xlab="Mean",ylab="Difference",main="WT vs KO",xlim=xlim,ylim=ylim)

main:グラフタイトル
xlab, ylab:軸ラベル
xlim, ylim:軸範囲

発現量に応じて色分け

xlim=c(0,20)
ylim=c(-5,5)

plot(x[x$contrast<(-1),2],x[x$contrast<(-1),ncol(x)],col="blue",
     xlab="",ylab="",xlim=xlim,ylim=ylim)
par(new=T)
plot(x[x$contrast>1,2],x[x$contrast>1,ncol(x)],col="red",
     xlab="",ylab="",xlim=xlim,ylim=ylim)
par(new=T)
plot(x[x$contrast<1 & x$contrast > -1 ,2],x[x$contrast<1 & x$contrast > -1 ,ncol(x)],col="black",
     xlab="Mean",ylab="Difference",main="WT vs KO",xlim=xlim,ylim=ylim)

xlim, ylimは3色全てで同じになるように指定する必要あり

特定遺伝子をプロット

上記のものに追記する形で表示できます。今回はシンボルから指定します。

par(new=T)
gene_name="Gapdh"
plot(x[tolower(x[,1])==tolower(gene_name),2],x[x[,1])==tolower(gene_name),ncol(x)],col="Green", pch=19, cex=1.5, 
     xlab="",ylab="",xlim=xlim,ylim=ylim)

pch:点の形状
cex:点のサイズ
1遺伝子に対し、プローブが複数あるので、複数プロットされることがあります。

遺伝子セットのプロット

GSEA(http://software.broadinstitute.org/gsea/index.jsp) からダウンロードしたtxtファイルを想定してます。

target <- read.table("geneset.txt",header=F,skip=2)
target <- target$V1
cols <- rainbow(length(target))

for (i in target){
par(new=T)
plot(x[tolower(x[,1])==tolower(i),2],x[tolower(x[,1])==tolower(i),ncol(x)],col=cols[col_num], pch=19, cex=1.5, 
     xlab="",ylab="",xlim=xlim,ylim=ylim)
col_num <- col_num+1}

遺伝子ごとに色を変えるようにしたんですが、遺伝子数が多いと却って分かりにくくなってしまった感

おわり

かなり強引にやってしまった感が強いので、スマートな方法知ってる人いたら教えてください

1
1
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
1
1