Re: [問題] 請問要怎麼把.CEL檔的內容畫出來?

作者: celestialgod (天)   2015-05-16 20:33:01
※ 引述《soheadsome (師大狗鼻哥)》之銘言:
: [問題敘述]:
: 將.cel檔(生物晶片)的內容畫成跟affymetrix .dat ImageViewer類型的圖
: 目前只知道使用affy的ReadAffy讀出內容
: 然後用image()去畫黑白的圖片
: 但不知道要怎麼畫出跟類似附圖的內容
: http://imgur.com/6cqCCQF
: 還是有其他方式可以畫出.cel檔的內容呢?
: 附檔:
: https://goo.gl/wUR1t7
我測試了一下,這樣應該是對的
只是你的附圖是否對應到這個資料,我不確定
你可以在levelplot加入col.regions來調整顏色
## install affy
# source("http://bioconductor.org/biocLite.R")
# biocLite("affy")
library(affy)
mat = ReadAffy("GSM21708.CEL")
dat = data.frame(intensity(mat),
x = rep(1:nrow(mat), ncol(mat)),
y = rep(1:ncol(mat), each=nrow(mat)))
library(lattice)
levelplot(GSM21708.CEL ~ x + y, dat)
levelplot(log(GSM21708.CEL) ~ x + y, dat)
# partial
library(dplyr)
dat2 = filter(dat, x <= 200, y <= 200)
levelplot(GSM21708.CEL ~ x + y, dat2)
# mean
library(magrittr)
r = 1
G = ceiling(max(dat$x)/(2*r+1))
dat3 = dat %>% mutate(group = ceiling(x/(2*r+1))) %>%
transform(group = group + G*(ceiling(y/(2*r+1))-1)) %>%
group_by(group) %>% summarise(int2 = mean(GSM21708.CEL)) %>%
mutate(xnew = group %% G, ynew = floor(group / G)+1)
levelplot(int2 ~ xnew + ynew, dat3)
# similar colorkey
ramp = colorRamp(c("blue", "cyan", "yellow", "orange", "red", "white"))
colorkey = rgb(ramp(seq(0, 1, length = 18)), max = 255)
levelplot(GSM21708.CEL ~ x + y, dat, col.regions = colorkey)
levelplot(log(GSM21708.CEL) ~ x + y, dat, col.regions = colorkey)
作者: soheadsome (師大狗鼻哥)   2015-05-16 21:02:00
感謝大大OTZ

Links booklink

Contact Us: admin [ a t ] ucptt.com