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