view 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
line wrap: on
line source

#!/usr/bin/env Rscript

# Setup R error handling to go to stderr
options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )

# we need that to not crash galaxy with an UTF8 error on German LC settings.
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")

## Get parameters ##
suppressPackageStartupMessages(require(argparse))

parser <- ArgumentParser(description='Run the computeMatSimilarity function')

parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file")
parser$add_argument('--output_rdata', dest='output_rdata', required=TRUE, help="Output RData file")

args <- parser$parse_args()

## Print parameters
print("Input RData:")
print(args$input_rdata)
print("Output RData:")
print(args$output_rdata)

## Loading libraries
# suppressPackageStartupMessages(require(mixOmics))

# R script call
source_local <- function(fname)
{
    argv <- commandArgs(trailingOnly = FALSE)
    base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
    source(paste(base_dir, fname, sep="/"))
}
## Loading local functions
source_local("Integration_block_splsda_fonc.R")

load(args$input_rdata)

liste_res_matSimilarity_group = compute_matSimilarity(liste_dataframe_cor_comp_var_global)

liste_matSimilarity_group = liste_res_matSimilarity_group$liste_matSimilarity_group
comp = liste_res_matSimilarity_group$comp

save(liste_matSimilarity_group,
     comp,
     file = args$output_rdata)