# HG changeset patch # User ppericard # Date 1602764545 0 # Node ID e93350dc99f1f0644767575f1ff65b96f76928da # Parent d0b77b92686383a66176ea7756c5fb17d7ecb20c "planemo upload for repository https://gitlab.com/bilille/galaxy-viscorvar commit 1eda261d4fe137d6e8806b0c6af7eaf12d11ac95" diff -r d0b77b926863 -r e93350dc99f1 additional_functions_block_splsda.R --- a/additional_functions_block_splsda.R Tue Jun 23 19:57:35 2020 -0400 +++ b/additional_functions_block_splsda.R Thu Oct 15 12:22:25 2020 +0000 @@ -1,55 +1,3 @@ -#' @title Check if a block contains missing values -#' @description Check if a block contains missing values -#' @param list_X type : list of matrix. This list is used to perform the data integration. -#' @details This function checks if a block contains missing values. -#' @return type : boolean. If at least one block contains missing values, -#' this function returns TRUE, otherwise this function returns FALSE. -#' @examples -#' X1 = matrix(1:9, nrow = 3, ncol = 3) -#' X2 = matrix(10:18, nrow = 3, ncol = 3) -#' list_X = list() -#' list_X[[1]] = X1 -#' list_X[[2]] = X2 -#' names(list_X) = c("X1", "X2") -#' boolean_block_missing_values = blockMissingValues(list_X) -#' @export -blockMissingValues <-function(list_X) -{ - name_blocks = names(list_X) - name_blocks_missing_values = c() - boolean_block_missing_values = FALSE - - for(i in 1:length(list_X)) - { - X_i = list_X[[i]] - name_block_i = name_blocks[i] - - vec = sapply(1:dim(X_i)[2], FUN = function(j){ - res = any(is.na(X_i[, j])) - - return(res) - }) - - if(any(vec)) - { - name_blocks_missing_values = c(name_blocks_missing_values, name_block_i) - - } - - } # End for(i in 1:length(list_X)). - - if(length(name_blocks_missing_values) != 0) - { - stop(paste("The data integration can not be performed if a block contains missing values : ", paste(name_blocks_missing_values, collapse = ", "), " contains missing values. ")) - boolean_block_missing_values = TRUE - - } - - return(boolean_block_missing_values) - -} - - #' @title Determination of selected variables for all components #' @description The function unionSelectBlockVariables determines, for each block, the selected block variables #' for all components. diff -r d0b77b926863 -r e93350dc99f1 circleCor.xml --- a/circleCor.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/circleCor.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,14 +1,10 @@ - + plots a correlation circle for the datasets whose correlation circles can be superimposed. This correlation circle contains the selected variables of these datasets which are included in a rectangle and the response variables. - bioconductor-mixomics - + r-viscorvar r-argparse - - - diff -r d0b77b926863 -r e93350dc99f1 circleCor_wrapper.R --- a/circleCor_wrapper.R Tue Jun 23 19:57:35 2020 -0400 +++ b/circleCor_wrapper.R Thu Oct 15 12:22:25 2020 +0000 @@ -58,7 +58,7 @@ # suppressPackageStartupMessages(require(mixOmics)) ## Loading local functions # source_local("mixomics-blocksplsda-integration/integration_block_splsda_func.R") -install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.3.tar.gz", repos=NULL) +install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.5.tar.gz", repos=NULL) suppressPackageStartupMessages(require(visCorVar)) print("visCorVar has been loaded") @@ -102,7 +102,7 @@ print("res_compute_cor_var_interest:") print(res_compute_cor_var_interest) -# Open output pdf file +# Open output pdf file pdf(args$output_pdf, width=8, height=7) mar = c(5, 5, 2, 8) par(mar = mar) @@ -114,7 +114,7 @@ names_blocks = names_blocks, names_response_variables = names_response_variables, comp = comp, - cutoff = 0.85, + cutoff = 0.80, min.X = args$x_min, max.X = args$x_max, min.Y = args$y_min, diff -r d0b77b926863 -r e93350dc99f1 computeMatSimilarity.xml --- a/computeMatSimilarity.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/computeMatSimilarity.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,9 +1,9 @@ - + performs the computation of the similarities. The similarity between two variables is an approximation of the correlation between these two variables. - bioconductor-mixomics + r-viscorvar r-argparse diff -r d0b77b926863 -r e93350dc99f1 computeMatSimilarity_wrapper.R --- a/computeMatSimilarity_wrapper.R Tue Jun 23 19:57:35 2020 -0400 +++ b/computeMatSimilarity_wrapper.R Thu Oct 15 12:22:25 2020 +0000 @@ -35,7 +35,7 @@ ## Loading local functions # source_local("mixomics-blocksplsda-integration/integration_block_splsda_func.R") -install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.3.tar.gz", repos=NULL) +install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.5.tar.gz", repos=NULL) suppressPackageStartupMessages(require(visCorVar)) print("visCorVar has been loaded") diff -r d0b77b926863 -r e93350dc99f1 matCorAddVar.xml --- a/matCorAddVar.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/matCorAddVar.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,24 +1,23 @@ - + determine the correlation circles that can be overlaid and compute the correlations - bioconductor-mixomics + r-viscorvar r-argparse - - + + help="variables not belonging to any block will not be considered"/> diff -r d0b77b926863 -r e93350dc99f1 matCorAddVar_wrapper.R --- a/matCorAddVar_wrapper.R Tue Jun 23 19:57:35 2020 -0400 +++ b/matCorAddVar_wrapper.R Thu Oct 15 12:22:25 2020 +0000 @@ -39,7 +39,7 @@ ## Loading libraries # source_local("mixomics-blocksplsda-integration/integration_block_splsda_func.R") -install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.3.tar.gz", repos=NULL) +install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.5.tar.gz", repos=NULL) suppressPackageStartupMessages(require(visCorVar)) print("visCorVar has been loaded") diff -r d0b77b926863 -r e93350dc99f1 mixomics_blocksplsda.xml --- a/mixomics_blocksplsda.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_blocksplsda.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,4 +1,4 @@ - + performs N-integration and feature selection with Projection to Latent Structures models (PLS) with sparse Discriminant Analysis @@ -41,7 +41,7 @@ ##--tol ${adv.tol} ##${adv.nearzerovar} --rdata_out ${rdata_out} - --sample_metadata_out ${sample_metadata_out} + ##--sample_metadata_out ${sample_metadata_out} --variable_metadata_outdir outdir ]]> @@ -107,8 +107,8 @@ - + diff -r d0b77b926863 -r e93350dc99f1 mixomics_blocksplsda_script.R --- a/mixomics_blocksplsda_script.R Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_blocksplsda_script.R Thu Oct 15 12:22:25 2020 +0000 @@ -36,7 +36,7 @@ parser$add_argument('--nearzerovar', dest='nearzerovar', action="store_true", help="Should be set in particular for data with many zero values") parser$add_argument('--rdata_out', dest='rdata_out', required=TRUE, help="Output Rdata file") -parser$add_argument('--sample_metadata_out', dest='sample_metadata_out', required=TRUE, help="Output sample metadata file") +# parser$add_argument('--sample_metadata_out', dest='sample_metadata_out', required=TRUE, help="Output sample metadata file") parser$add_argument('--variable_metadata_outdir', dest='variable_metadata_outdir', required=TRUE, help="Output variable metadata directory") args <- parser$parse_args() @@ -68,8 +68,8 @@ print(args$nearzerovar) print("Output Rdata file:") print(args$rdata_out) -print("Output sample metadata file:") -print(args$sample_metadata_out) +# print("Output sample metadata file:") +# print(args$sample_metadata_out) print("Output variable metadata directory:") print(args$variable_metadata_outdir) @@ -119,6 +119,11 @@ stop("Sample names must be the same and in the same order in the sample metadata matrix and the block data matrix") } + if(any(is.na(block_data_matrix))) + { + stop(sprintf("Block %s contains missing values. We recommend not to perform data integration with missing values. If you want to force run, change the advanced parameter 'Check for missing values' to 'No'.", block_name)) + } + list_X[[block_name]] <- block_data_matrix # Set the nb of variables to keep @@ -175,26 +180,41 @@ ## Save output Rdata file save(mixomics_result, file=args$rdata_out) +# 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="/")) +} + +# Load library +source_local("additional_functions_block_splsda.R") + + + +list_union_selected_block_variables = unionSelectBlockVariables(mixomics_result) + ## Save output sample metadata file # print("Block.splsda variates:") # print(mixomics_result$variates) -for(block_name in names(mixomics_result$variates)) -{ - # print(block_name) - # print(mixomics_result$variates[[block_name]]) +# for(block_name in names(mixomics_result$variates)) +# { +# # print(block_name) +# # print(mixomics_result$variates[[block_name]]) - # Format the column names to add the block name and replace spaces - colnames(mixomics_result$variates[[block_name]]) <- paste("block.splsda_variates", block_name, gsub(" ", "_", colnames(mixomics_result$variates[[block_name]])), sep = "_") - # print(mixomics_result$variates[[block_name]]) +# # Format the column names to add the block name and replace spaces +# colnames(mixomics_result$variates[[block_name]]) <- paste("block.splsda_variates", block_name, gsub(" ", "_", colnames(mixomics_result$variates[[block_name]])), sep = "_") +# # print(mixomics_result$variates[[block_name]]) - # Append the new columns to the sample metadata matrix - sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[block_name]]) -} +# # Append the new columns to the sample metadata matrix +# sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[block_name]]) +# } # print(sample_metadata) -write.table(sample_metadata, file = args$sample_metadata_out, quote = TRUE, sep = "\t", row.names = TRUE, col.names = NA) +# write.table(sample_metadata, file = args$sample_metadata_out, quote = TRUE, sep = "\t", row.names = TRUE, col.names = NA) ## Save output variable metadata files in output directory # print("Block.splsda loadings:") @@ -210,11 +230,15 @@ print(sprintf("Saving block %s output metavar", block_name)) - meta_variable <- mixomics_result$loadings[[block_name]] + + meta_variable <- list_union_selected_block_variables[[i]] + colnames(meta_variable) <- "block.splsda_var_select" + + # meta_variable <- mixomics_result$loadings[[block_name]] # print(head(meta_variable)) # Format the column names to add the block name and replace spaces - colnames(meta_variable) <- paste("block.splsda_loadings", gsub(" ", "_", colnames(meta_variable)), sep = "_") + # colnames(meta_variable) <- paste("block.splsda_loadings", gsub(" ", "_", colnames(meta_variable)), sep = "_") # Read input block variable metadata files if provided (optional) if(block_meta_var != "None") @@ -230,4 +254,4 @@ block_meta_var_output_filename <- paste("mixomics_blocksplsda_block_", block_name, "_variable_metadata.tsv", sep="") write.table(meta_variable, file = paste(args$variable_metadata_outdir,block_meta_var_output_filename, sep='/'), quote = TRUE, sep = "\t", row.names = TRUE, col.names = NA) -} \ No newline at end of file +} diff -r d0b77b926863 -r e93350dc99f1 mixomics_plotindiv.xml --- a/mixomics_plotindiv.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_plotindiv.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,4 +1,4 @@ - + provides scatter plots for individuals (experimental units) representation in (sparse)(I)PCA,(regularized)CCA, (sparse)PLS(DA) and (sparse)(R)GCCA(DA) diff -r d0b77b926863 -r e93350dc99f1 mixomics_plotindiv_script.R --- a/mixomics_plotindiv_script.R Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_plotindiv_script.R Thu Oct 15 12:22:25 2020 +0000 @@ -33,7 +33,9 @@ load(args$input_rdata) -pdf(args$output_pdf) +pdf(args$output_pdf, width=8, height=7) +mar = c(5, 5, 2, 8) +par(mar = mar) # plotIndiv(mixomics_result, # legend = args$legend, diff -r d0b77b926863 -r e93350dc99f1 mixomics_plotvar.xml --- a/mixomics_plotvar.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_plotvar.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,4 +1,4 @@ - + provides variables representation for (regularized) CCA, (sparse) PLS regression, PCA and (sparse) Regularized generalised CCA diff -r d0b77b926863 -r e93350dc99f1 mixomics_plotvar_script.R --- a/mixomics_plotvar_script.R Tue Jun 23 19:57:35 2020 -0400 +++ b/mixomics_plotvar_script.R Thu Oct 15 12:22:25 2020 +0000 @@ -34,7 +34,9 @@ load(args$input_rdata) -pdf(args$output_pdf) +pdf(args$output_pdf, width=8, height=7) +mar = c(5, 5, 2, 8) +par(mar = mar) # plotVar(mixomics_result, # legend = args$legend, diff -r d0b77b926863 -r e93350dc99f1 networkVar.xml --- a/networkVar.xml Tue Jun 23 19:57:35 2020 -0400 +++ b/networkVar.xml Thu Oct 15 12:22:25 2020 +0000 @@ -1,10 +1,9 @@ - + creates a network between selected variables of datasets and the response variables. In the network, the similarity between two variables is associated with the link between these two variables. - bioconductor-mixomics - r-igraph + r-viscorvar r-argparse diff -r d0b77b926863 -r e93350dc99f1 networkVar_wrapper.R --- a/networkVar_wrapper.R Tue Jun 23 19:57:35 2020 -0400 +++ b/networkVar_wrapper.R Thu Oct 15 12:22:25 2020 +0000 @@ -45,7 +45,7 @@ ## Loading local functions # source_local("mixomics-blocksplsda-integration/integration_block_splsda_func.R") -install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.3.tar.gz", repos=NULL) +install.packages("https://gitlab.com/bilille/mixomics-blocksplsda-integration/-/raw/master/visCorVar_0.5.tar.gz", repos=NULL) suppressPackageStartupMessages(require(visCorVar)) print("visCorVar has been loaded")