20 likes | 136 Views
Example R Answer. data <- read.delim ("GSE9412_sample_data.txt") data1 <- subset(data, !is.na(GSM239309)) getFoldChange <- function( x,y ) { return ( log2( as.numeric (x)) - log2( as.numeric (y))) } getSignificance <- function( x,y ) {
E N D
Example R Answer data <- read.delim("GSE9412_sample_data.txt") data1 <- subset(data, !is.na(GSM239309)) getFoldChange <- function(x,y) { return( log2(as.numeric(x)) - log2(as.numeric(y))) } getSignificance <- function(x,y) { return( -log10(t.test(as.numeric(x),as.numeric(y))$p.value)) } data1$res <- apply(data1[,2:4], 1, mean) data1$sen <- apply(data1[,5:7], 1, mean) data1$effect <- apply(data1, 1, function(x) getFoldChange(x[8],x[9])) data1$sig <- apply(data1, 1, function(x) getSignificance(x[2:4],x[5:7])) plot(data1$effect, data1$sig, main="GSE9412 Volcano Plot", xlab="Effect", ylab="Significance")
One point about plots From : http://xkcd.com/833/