if (FALSE) {
# Compute mean profiles for genes
# and plot the means as a heatmap with the color scale on the side
library (fields) # to use function image.plot
data (tc.data)
times = c(0,5,10,15,20,25,30,35,40,50,60,70,80,90,100,110,120,150)
# Organize data into array of nGene-by-nTime-by-nRep
SKIP=2
nTime=length (times)
nGene = nrow (tc.data)
nRep = (ncol (tc.data) - SKIP) / nTime
ts = array (0, dim = c(nGene, nTime, nRep))
for (r in 1:nRep) {
ts[,,r] = as.matrix (tc.data[,SKIP + (0:(nTime-1))*nRep + r])
}
# Compute mean profile for each gene
ts.mean = apply (ts, c(1,2), mean)
# Plot heatmap for mean profiles
image.plot (1:nGene, times, as.matrix(ts.mean),
xlab="gene", ylab="time (min)",
cex=1.5, cex.axis = 1.6, cex.lab = 1.6,
legend.shrink=1, legend.width=2, col=topo.colors(8))
}
Run the code above in your browser using DataLab