Mercurial > repos > greg > ideas
changeset 135:fc94a1ce21eb draft
Uploaded
author | greg |
---|---|
date | Fri, 15 Dec 2017 16:48:53 -0500 |
parents | 91db24a1384d |
children | 8d41990f4fc5 |
files | create_heatmap.R |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/create_heatmap.R Fri Dec 15 16:48:18 2017 -0500 +++ b/create_heatmap.R Fri Dec 15 16:48:53 2017 -0500 @@ -3,8 +3,8 @@ suppressPackageStartupMessages(library("optparse")) option_list <- list( - make_option(c("-i", "--input_dir"), action="store", dest="input_dir", help="IDEAS para files directory"), - make_option(c("-o", "--output_dir"), action="store", dest="output_dir", help="PDF output directory") + make_option(c("-i", "--input_dir"), action="store", dest="input_dir", help="IDEAS para files directory"), + make_option(c("-o", "--output_dir"), action="store", dest="output_dir", help="PDF output directory") ) parser <- OptionParser(usage="%prog [options] file", option_list=option_list) @@ -19,9 +19,9 @@ num_rows = dim(data_frame)[1]; p = (sqrt(9 + 8 * (num_columns - 1)) - 3) / 2; data_matrix = as.matrix(data_frame[,1+1:p] / data_frame[,1]); - column_names(data_matrix) = column_names(data_frame)[1+1:p]; - marks = column_names(data_matrix); - row_names(data_matrix) = paste(1:num_rows, " (", round(data_frame[,1]/sum(data_frame[,1])*10000)/100, "%)", sep=""); + colnames(data_matrix) = colnames(data_frame)[1+1:p]; + marks = colnames(data_matrix); + rownames(data_matrix) = paste(1:num_rows, " (", round(data_frame[,1]/sum(data_frame[,1])*10000)/100, "%)", sep=""); # Open the output PDF file. pdf(file=output_file_name); @@ -35,9 +35,9 @@ my_palette = colorRampPalette(c("white", "dark blue"))(n=100); defpalette = palette(my_palette); # Plot the heatmap for the current .para / .state combination. - plot(NA, NA, xlim=c(0,p+0.7), ylim=c(0,l), xaxt="n", yaxt="n", xlab=NA, ylab=NA, frame.plot=F); - axis(1, at=1:p-0.5, labels=column_names(data_matrix), las=2); - axis(4, at=1:num_rows-0.5, labels=row_names(data_matrix), las=2); + plot(NA, NA, xlim=c(0, p+0.7), ylim=c(0, num_rows), xaxt="n", yaxt="n", xlab=NA, ylab=NA, frame.plot=F); + axis(1, at=1:p-0.5, labels=colnames(data_matrix), las=2); + axis(4, at=1:num_rows-0.5, labels=rownames(data_matrix), las=2); rect(rep(1:p-1, num_rows), rep(1:num_rows, each=p), rep(1:p, num_rows), rep(1:num_rows, each=p), col=round((t(data_matrix)-min_max_vector[1])/(min_max_vector[2]-min_max_vector[1])*100)); markcolor = t(col2rgb(terrain.colors(ceiling(p))[1:p]));