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