annotate computeMatSimilarity_wrapper.R @ 3:0a3c83f2197a draft

planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
author ppericard
date Fri, 25 Oct 2019 07:10:59 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
1 #!/usr/bin/env Rscript
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
2
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
3 # Setup R error handling to go to stderr
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
4 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
5
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
6 # we need that to not crash galaxy with an UTF8 error on German LC settings.
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
7 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
8
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
9 ## Get parameters ##
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
10 suppressPackageStartupMessages(require(argparse))
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
11
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
12 parser <- ArgumentParser(description='Run the computeMatSimilarity function')
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
13
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
14 parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
15 parser$add_argument('--output_rdata', dest='output_rdata', required=TRUE, help="Output RData file")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
16
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
17 args <- parser$parse_args()
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
18
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
19 ## Print parameters
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
20 print("Input RData:")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
21 print(args$input_rdata)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
22 print("Output RData:")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
23 print(args$output_rdata)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
24
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
25 ## Loading libraries
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
26 # suppressPackageStartupMessages(require(mixOmics))
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
27
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
28 # R script call
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
29 source_local <- function(fname)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
30 {
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
31 argv <- commandArgs(trailingOnly = FALSE)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
32 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
33 source(paste(base_dir, fname, sep="/"))
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
34 }
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
35 ## Loading local functions
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
36 source_local("Integration_block_splsda_fonc.R")
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
37
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
38 load(args$input_rdata)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
39
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
40 liste_res_matSimilarity_group = compute_matSimilarity(liste_dataframe_cor_comp_var_global)
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
41
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
42 liste_matSimilarity_group = liste_res_matSimilarity_group$liste_matSimilarity_group
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
43 comp = liste_res_matSimilarity_group$comp
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
44
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
45 save(liste_matSimilarity_group,
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
46 comp,
0a3c83f2197a planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 24b8259494ac7ab10cbd1f9ee991f455a7507590-dirty
ppericard
parents:
diff changeset
47 file = args$output_rdata)