| library(affy)
# need to substitute in name of directory to which CEL files were saved from SBEAMS
setwd("/path/to/CEL/files")
fn = c("20040630_01_G85_A_yf.CEL","20040630_03_G85_B_yf.CEL",
"20040630_05_G85_C_yf.CEL","20040630_02_G85_A_ff.CEL","20040630_04_G85_B_ff.CEL",
"20040630_06_G85_C_ff.CEL","20040629_01_G85_A_ffLiq.CEL",
"20040629_02_G85_B_ffLiq.CEL","20040630_07_G85_C_ffLiq.CEL",
"20040719_01_G85_D_yf.CEL","20040719_02_G85_E_yf.CEL","20040719_03_G85_F_yf.CEL")
eset <- justRMA(filenames = fn)
|
| Matrix <- exprs(eset)
get.pval.ttest <- function(dataf,index1,index2,
datafilter=as.numeric){
f <- function(i) {
return(t.test(datafilter(dataf[i,index1]),
datafilter(dataf[i,index2]))$p.value)
}
return(sapply(1:length(dataf[,1]),f))
}
# compare chips 1-3 vs 4-6
pValues <- get.pval.ttest(Matrix,1:3,4:6)
orders <- order(pValues)
ordered.data <- cbind(rownames(Matrix)[orders],Matrix[orders,],
pValues[orders])
write.table(ordered.data,file="U:/G85_yf_vs_ff.txt",sep="\t")
# compare chips 1-3 vs 7-9
pValues <- get.pval.ttest(Matrix,1:3,7:9)
orders <- order(pValues)
ordered.data <- cbind(rownames(Matrix)[orders],Matrix[orders,],
pValues[orders])
write.table(ordered.data,file="U:/G85_yf_vs_ffLiq.txt",sep="\t")
# compare chips 4-6 vs 7-9
pValues <- get.pval.ttest(Matrix,4:6,7:9)
orders <- order(pValues)
ordered.data <- cbind(rownames(Matrix)[orders],Matrix[orders,],
pValues[orders])
write.table(ordered.data,file="U:/G85_ff_vs_ffLiq.txt",sep="\t")
# compare chips 1-3 vs 10-12
pValues <- get.pval.ttest(Matrix,1:3,10:12)
orders <- order(pValues)
ordered.data <- cbind(rownames(Matrix)[orders],Matrix[orders,],
pValues[orders])
# substitute in where you’d like to save the results
write.table(ordered.data,file="/output/path /G85_yf_vs_yf.txt",sep="\t")
|