comparison mixomics_plotindiv.R @ 2:c8533e9298e5 draft

"planemo upload for repository https://gitlab.com/bilille/galaxy-viscorvar commit 8cb5630238352459037b3647eebfabb5554566f6-dirty"
author ppericard
date Fri, 23 Oct 2020 10:15:56 +0000
parents
children
comparison
equal deleted inserted replaced
1:e93350dc99f1 2:c8533e9298e5
1 #!/usr/bin/env Rscript
2
3 # Setup R error handling to go to stderr
4 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
5
6 # we need that to not crash galaxy with an UTF8 error on German LC settings.
7 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
8
9 ## Get parameters ##
10 suppressPackageStartupMessages(require(argparse))
11
12 parser <- ArgumentParser(description='Run the mixOmics plotIndiv function')
13
14 parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file")
15 parser$add_argument('--legend', dest='legend', action="store_true", help="Display the legend")
16 parser$add_argument('--ellipse', dest='ellipse', action="store_true", help="Plot ellipse plots")
17 parser$add_argument('--output_pdf', dest='output_pdf', required=TRUE, help="Output PDF file")
18
19 args <- parser$parse_args()
20
21 ## Print parameters
22 print("Input RData:")
23 print(args$input_rdata)
24 print("Plot legend:")
25 print(args$legend)
26 print("Plot ellipse plots:")
27 print(args$ellipse)
28 print("Output PDF file:")
29 print(args$output_pdf)
30
31 # loading libraries
32 suppressPackageStartupMessages(require(mixOmics))
33
34 load(args$input_rdata)
35
36 pdf(args$output_pdf, width=8, height=7)
37 mar = c(5, 5, 2, 8)
38 par(mar = mar)
39
40 # plotIndiv(mixomics_result,
41 # legend = args$legend,
42 # ellipse = args$ellipse)
43
44 for(k in 1:(length(mixomics_result$names[[3]])-1))
45 {
46 name_block = mixomics_result$names[[3]][k]
47
48 try(plotIndiv(mixomics_result,
49 blocks = k,
50 legend = args$legend,
51 ellipse = args$ellipse),
52 silent = FALSE)
53 }
54
55 dev.off()