|
|
|
|
|
|
|
|
|
|
|
|
|
|
suppressPackageStartupMessages(library(gplots)) |
|
|
|
|
|
|
|
|
count_file = "results.csv" |
|
|
|
|
|
|
|
|
output_file = "heatmap.pdf" |
|
|
|
|
|
|
|
|
print("# Tool: Create Heatmap ") |
|
|
print(paste("# Input: ", count_file)) |
|
|
print(paste("# Output: ", output_file)) |
|
|
|
|
|
|
|
|
MIN_FDR = 0.05 |
|
|
|
|
|
|
|
|
WIDTH = 12 |
|
|
|
|
|
|
|
|
HEIGHT = 13 |
|
|
|
|
|
|
|
|
MARGINS = c(9, 12) |
|
|
|
|
|
|
|
|
LHEI = c(1, 5) |
|
|
|
|
|
|
|
|
data = read.csv(count_file, header=T, as.is=TRUE) |
|
|
|
|
|
|
|
|
data = subset(data, data$FDR <= MIN_FDR) |
|
|
|
|
|
|
|
|
row_names = data[, 1] |
|
|
|
|
|
|
|
|
idx = which(colnames(data) == "falsePos") + 1 |
|
|
|
|
|
|
|
|
counts = data[, idx : ncol(data)] |
|
|
|
|
|
|
|
|
values = as.matrix(counts) |
|
|
|
|
|
|
|
|
|
|
|
values = jitter(values, factor = 1, amount = 0.00001) |
|
|
|
|
|
|
|
|
zscores = NULL |
|
|
for (i in 1 : nrow(values)) { |
|
|
row = values[i,] |
|
|
zrow = (row - mean(row)) / sd(row) |
|
|
zscores = rbind(zscores, zrow) |
|
|
} |
|
|
|
|
|
|
|
|
row.names(zscores) = row_names |
|
|
|
|
|
|
|
|
zscores = as.matrix(zscores) |
|
|
|
|
|
|
|
|
col = greenred |
|
|
|
|
|
|
|
|
pdf(output_file, width = WIDTH, height = HEIGHT) |
|
|
|
|
|
heatmap.2(zscores, col=col, density.info="none", Colv=NULL, |
|
|
dendrogram="row", trace="none", margins=MARGINS, lhei=LHEI) |
|
|
|
|
|
|
|
|
|
|
|
|