comparison mixomics_plotindiv_script.R @ 0:d0b77b926863 draft

"planemo upload for repository https://gitlab.com/bilille/galaxy-viscorvar commit 85dac6b13a9adce48b47b2b8cb28d2319ae9c1ca-dirty"
author ppericard
date Tue, 23 Jun 2020 19:57:35 -0400
parents
children e93350dc99f1
comparison
equal deleted inserted replaced
-1:000000000000 0:d0b77b926863
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)
37
38 # plotIndiv(mixomics_result,
39 # legend = args$legend,
40 # ellipse = args$ellipse)
41
42 for(k in 1:(length(mixomics_result$names[[3]])-1))
43 {
44 name_block = mixomics_result$names[[3]][k]
45
46 try(plotIndiv(mixomics_result,
47 blocks = k,
48 legend = args$legend,
49 ellipse = args$ellipse),
50 silent = FALSE)
51 }
52
53 dev.off()