comparison mixomics_plotindiv_script.R @ 0:bea08702ed51 draft

planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 7595141b2b760d3c9781f350abd2aa76a0644b1a
author ppericard
date Fri, 17 May 2019 05:00:22 -0400
parents
children 0a3c83f2197a
comparison
equal deleted inserted replaced
-1:000000000000 0:bea08702ed51
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 ## Main Function ##
10
11 suppressPackageStartupMessages(require(argparse))
12
13 parser <- ArgumentParser(description='Run the mixOmics plotIndiv function')
14
15 parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file")
16 parser$add_argument('--legend', dest='legend', action="store_true", help="Display the legend")
17 parser$add_argument('--ellipse', dest='ellipse', action="store_true", help="Plot ellipse plots")
18 parser$add_argument('--output_pdf', dest='output_pdf', required=TRUE, help="Output PDF file")
19
20 args <- parser$parse_args()
21
22 ##
23 print("Input RData:")
24 print(args$input_rdata)
25 print("Plot legend:")
26 print(args$legend)
27 print("Plot ellipse plots:")
28 print(args$ellipse)
29 print("Output PDF file:")
30 print(args$output_pdf)
31
32 # loading libraries
33 suppressPackageStartupMessages(require(mixOmics))
34
35 load(args$input_rdata)
36
37 pdf(args$output_pdf)
38
39 plotIndiv(mixomics_result,
40 legend = args$legend,
41 ellipse = args$ellipse)
42
43 for(k in 1:(length(mixomics_result$names[[3]])-1))
44 {
45 name_block = mixomics_result$names[[3]][k]
46
47 plotIndiv(mixomics_result,
48 blocks = k,
49 legend = args$legend,
50 ellipse = args$ellipse)
51 }
52
53 dev.off()