Mercurial > repos > ppericard > viscorvar
comparison mixomics_plotvar.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 ## Main Function ## | |
10 | |
11 suppressPackageStartupMessages(require(argparse)) | |
12 | |
13 parser <- ArgumentParser(description='Run the mixOmics plotVar 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('--cutoff', dest='cutoff', type='double', required=TRUE, help="Cutoff (0..1)") | |
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("Cutoff:") | |
28 print(args$cutoff) | |
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, width=8, height=7) | |
38 mar = c(5, 5, 2, 8) | |
39 par(mar = mar) | |
40 | |
41 # plotVar(mixomics_result, | |
42 # legend = args$legend, | |
43 # cutoff = args$cutoff) | |
44 | |
45 for(k in 1:(length(mixomics_result$names[[3]])-1)) | |
46 { | |
47 name_block = mixomics_result$names[[3]][k] | |
48 | |
49 # We're still continuing even if a graph is empty | |
50 try(plotVar(mixomics_result, | |
51 blocks = k, | |
52 legend = args$legend, | |
53 cutoff = args$cutoff), | |
54 silent = FALSE) | |
55 | |
56 } | |
57 | |
58 dev.off() |