Fixed #1, heatmap ranges.
This commit is contained in:
+11
-11
@@ -304,6 +304,9 @@ plot_residuals = function(input.well, xlim = NULL, lowess = T, ...){
|
|||||||
#' @return path of heatmap pdf file
|
#' @return path of heatmap pdf file
|
||||||
#'
|
#'
|
||||||
create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL){
|
create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL){
|
||||||
|
# debug
|
||||||
|
#browser()
|
||||||
|
|
||||||
attr.name <- deparse(substitute(attribute))
|
attr.name <- deparse(substitute(attribute))
|
||||||
pdf.name <- ""
|
pdf.name <- ""
|
||||||
if(class(fitted.well.array) == "matrix"){
|
if(class(fitted.well.array) == "matrix"){
|
||||||
@@ -319,9 +322,9 @@ create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL)
|
|||||||
num.dig = 3 #how many digits should be put on pdf?
|
num.dig = 3 #how many digits should be put on pdf?
|
||||||
max = round(max(spec.growth, na.rm=T), digits=num.dig)
|
max = round(max(spec.growth, na.rm=T), digits=num.dig)
|
||||||
min = round(min(spec.growth, na.rm=T), digits=num.dig)
|
min = round(min(spec.growth, na.rm=T), digits=num.dig)
|
||||||
avg = round(mean(spec.growth, na.rm=T), digits=num.dig)
|
avg = round(median(spec.growth, na.rm=T), digits=num.dig)
|
||||||
heat.text = paste(toupper(sub("\\.", " ", attr.name)), ":\n", plate.ID, "\n",
|
heat.text = paste(toupper(sub("\\.", " ", attr.name)), ":\n", plate.ID, "\n",
|
||||||
paste("Max:",max ,"Min:" ,min ,"Avg:", avg, sep=""))
|
paste("Min:", min, "Med:", avg, "Max:", max, sep=" "))
|
||||||
|
|
||||||
attr.name <- sub("\\.", "_", attr.name) #do not want periods in file path
|
attr.name <- sub("\\.", "_", attr.name) #do not want periods in file path
|
||||||
letters <- attr(fitted.well.array, "dimnames")[[1]]
|
letters <- attr(fitted.well.array, "dimnames")[[1]]
|
||||||
@@ -334,16 +337,13 @@ create.heatmap = function(fitted.well.array, attribute, MinMax = NA, unlog=NULL)
|
|||||||
#heatmap(heat, Rowv=NA, Colv=NA, revC=T, scale="none", na.rm=T, main=plate.ID, col=rainbow(100), margins=c(6,6))
|
#heatmap(heat, Rowv=NA, Colv=NA, revC=T, scale="none", na.rm=T, main=plate.ID, col=rainbow(100), margins=c(6,6))
|
||||||
#mtext(paste("Max:", round(max(spec.growth, na.rm=T), digits=4),"Min:", round(min(spec.growth, na.rm=T), digits=4), "Avg:", round(mean(spec.growth, na.rm=T), digits=4)), side=1, line=3)
|
#mtext(paste("Max:", round(max(spec.growth, na.rm=T), digits=4),"Min:", round(min(spec.growth, na.rm=T), digits=4), "Avg:", round(mean(spec.growth, na.rm=T), digits=4)), side=1, line=3)
|
||||||
if (length(MinMax) == 2){
|
if (length(MinMax) == 2){
|
||||||
Mean = mean(MinMax)
|
# Min and max values to plot to floor and ceiling values if MinMax parameter was specified by the caller
|
||||||
bk = unique(c(seq(MinMax[1], Mean, length=50), seq(Mean, MinMax[2], length = 50)))
|
heat[is.finite(heat) & heat < MinMax[1]] = MinMax[1]
|
||||||
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"), breaks = bk,
|
heat[is.finite(heat) & heat > MinMax[2]] = MinMax[2]
|
||||||
border_color="black", cell_width=2, cell_height=3,
|
|
||||||
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16)
|
|
||||||
} else {
|
|
||||||
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"),
|
|
||||||
border_color="black", cell_width=2, cell_height=3,
|
|
||||||
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16)
|
|
||||||
}
|
}
|
||||||
|
pheatmap(heat, color=colorpanel(100, "red", "orange", "yellow"),
|
||||||
|
border_color="black", cell_width=2, cell_height=3,
|
||||||
|
cluster_rows=F, cluster_cols=F, scale='none', main=heat.text, fontsize=16)
|
||||||
dev.off()
|
dev.off()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Test that heatmaps are processed and generated correctly
|
||||||
|
# Yury V Bukhman, 01 July 2015
|
||||||
|
# This script generates heat maps with pre-set limits. Manually check output directory to see if they make sense.
|
||||||
|
|
||||||
|
INPUT.DIR = system.file("extdata/YPDAFEXglucoseTests_2-25-10",package="GCAT")
|
||||||
|
OUTPUT.DIR = paste(system.file("extdata/heatmap_tests",package="GCAT"),"temp",sep="/")
|
||||||
|
INPUT.FILE = "YPDAFEXglucoseTests_2-25-10.csv"
|
||||||
|
|
||||||
|
# Run GCAT
|
||||||
|
library(GCAT)
|
||||||
|
setwd(INPUT.DIR)
|
||||||
|
time.input=1/3600
|
||||||
|
out = gcat.analysis.main(file.list = INPUT.FILE, single.plate = T, layout.file = NULL,
|
||||||
|
out.dir = OUTPUT.DIR, graphic.dir = OUTPUT.DIR,
|
||||||
|
add.constant = 1, blank.value = NULL, start.index = 2, growth.cutoff = 0.05,
|
||||||
|
use.linear.param=F, use.loess=F, smooth.param=0.1,
|
||||||
|
points.to.remove = integer(), remove.jumps = F, time.input=time.input,
|
||||||
|
silent = F, verbose = T, return.fit = T, overview.jpgs = T,
|
||||||
|
lagRange = c(0,3), totalRange = c(0.2,0.82), specRange = c(0.04,0.13))
|
||||||
|
|
||||||
Reference in New Issue
Block a user