view plotPrediction.R @ 103:e7115e44d8d8 draft default tip

Uploaded
author nicolas
date Mon, 31 Oct 2016 07:20:49 -0400
parents d961f726b619
children
line wrap: on
line source

########################################################
#
# 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()