# HG changeset patch # User nicolas # Date 1477658838 14400 # Node ID 9262d1a91db9121ce1908ff22a50b4cda5d7f5de # Parent 4ce7b1bdb320862dfcab1514dbea81ced0d6afa7 Uploaded diff -r 4ce7b1bdb320 -r 9262d1a91db9 plotPrediction.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plotPrediction.R Fri Oct 28 08:47:18 2016 -0400 @@ -0,0 +1,30 @@ +######################################################## +# +# creation date : 07/06/16 +# last modification : 07/06/16 +# author : Dr Nicolas Beaume +# owner : IRRI +# +######################################################## + +library("miscTools") +# scatterplot of the prediction vs target +r2.plot <- function(true, predicted) { + # the scatterplot + plot(true, predicted, xlab="trait value", ylab="predicted value", main="", pch=16, + ylim=c(min(min(true), min(predicted)), max(max(true), max(predicted)))) + # add a red lines with ideal case + lines(true, true, col="red") +} + +############################ main ############################# +# load argument +cmd <- commandArgs(trailingOnly = T) +source(cmd[1]) +# load prediction and target +phenotype <- read.table(phenotype, sep="\t", h=T)[,1] +predicted <- read.table(predicted, sep = "\t", h=T)[,2] +# plot in a pdf that will be available in galaxy history panel +pdf(out) +r2.plot(phenotype, predicted = predicted) +dev.off() \ No newline at end of file