Mercurial > repos > nicolas > oghma
comparison plotPrediction.R @ 81:9262d1a91db9 draft
Uploaded
| author | nicolas |
|---|---|
| date | Fri, 28 Oct 2016 08:47:18 -0400 |
| parents | d961f726b619 |
| children |
comparison
equal
deleted
inserted
replaced
| 80:4ce7b1bdb320 | 81:9262d1a91db9 |
|---|---|
| 1 ######################################################## | |
| 2 # | |
| 3 # creation date : 07/06/16 | |
| 4 # last modification : 07/06/16 | |
| 5 # author : Dr Nicolas Beaume | |
| 6 # owner : IRRI | |
| 7 # | |
| 8 ######################################################## | |
| 9 | |
| 10 library("miscTools") | |
| 11 # scatterplot of the prediction vs target | |
| 12 r2.plot <- function(true, predicted) { | |
| 13 # the scatterplot | |
| 14 plot(true, predicted, xlab="trait value", ylab="predicted value", main="", pch=16, | |
| 15 ylim=c(min(min(true), min(predicted)), max(max(true), max(predicted)))) | |
| 16 # add a red lines with ideal case | |
| 17 lines(true, true, col="red") | |
| 18 } | |
| 19 | |
| 20 ############################ main ############################# | |
| 21 # load argument | |
| 22 cmd <- commandArgs(trailingOnly = T) | |
| 23 source(cmd[1]) | |
| 24 # load prediction and target | |
| 25 phenotype <- read.table(phenotype, sep="\t", h=T)[,1] | |
| 26 predicted <- read.table(predicted, sep = "\t", h=T)[,2] | |
| 27 # plot in a pdf that will be available in galaxy history panel | |
| 28 pdf(out) | |
| 29 r2.plot(phenotype, predicted = predicted) | |
| 30 dev.off() |
