Next changeset 1:6595c17673cb (2019-06-12) |
Commit message:
planemo upload for repository https://github.com/bilille/galaxy-mixomics-blocksplsda commit 7595141b2b760d3c9781f350abd2aa76a0644b1a |
added:
LICENSE README.md mixomics_blocksplsda.xml mixomics_blocksplsda_script.R mixomics_plotindiv.xml mixomics_plotindiv_script.R mixomics_plotvar.xml mixomics_plotvar_script.R test-data/in_block1_data.tabular test-data/in_block2_data.tabular test-data/in_sample_meta.tabular test-data/out_plotIndiv.pdf test-data/out_plotVar.pdf test-data/out_rdata.rdata test-data/out_sample_meta.tabular |
b |
diff -r 000000000000 -r bea08702ed51 LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE Fri May 17 05:00:22 2019 -0400 |
b |
b'@@ -0,0 +1,661 @@\n+ GNU AFFERO GENERAL PUBLIC LICENSE\n+ Version 3, 19 November 2007\n+\n+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n+ Everyone is permitted to copy and distribute verbatim copies\n+ of this license document, but changing it is not allowed.\n+\n+ Preamble\n+\n+ The GNU Affero General Public License is a free, copyleft license for\n+software and other kinds of works, specifically designed to ensure\n+cooperation with the community in the case of network server software.\n+\n+ The licenses for most software and other practical works are designed\n+to take away your freedom to share and change the works. By contrast,\n+our General Public Licenses are intended to guarantee your freedom to\n+share and change all versions of a program--to make sure it remains free\n+software for all its users.\n+\n+ When we speak of free software, we are referring to freedom, not\n+price. Our General Public Licenses are designed to make sure that you\n+have the freedom to distribute copies of free software (and charge for\n+them if you wish), that you receive source code or can get it if you\n+want it, that you can change the software or use pieces of it in new\n+free programs, and that you know you can do these things.\n+\n+ Developers that use our General Public Licenses protect your rights\n+with two steps: (1) assert copyright on the software, and (2) offer\n+you this License which gives you legal permission to copy, distribute\n+and/or modify the software.\n+\n+ A secondary benefit of defending all users\' freedom is that\n+improvements made in alternate versions of the program, if they\n+receive widespread use, become available for other developers to\n+incorporate. Many developers of free software are heartened and\n+encouraged by the resulting cooperation. However, in the case of\n+software used on network servers, this result may fail to come about.\n+The GNU General Public License permits making a modified version and\n+letting the public access it on a server without ever releasing its\n+source code to the public.\n+\n+ The GNU Affero General Public License is designed specifically to\n+ensure that, in such cases, the modified source code becomes available\n+to the community. It requires the operator of a network server to\n+provide the source code of the modified version running there to the\n+users of that server. Therefore, public use of a modified version, on\n+a publicly accessible server, gives the public access to the source\n+code of the modified version.\n+\n+ An older license, called the Affero General Public License and\n+published by Affero, was designed to accomplish similar goals. This is\n+a different license, not a version of the Affero GPL, but Affero has\n+released a new version of the Affero GPL which permits relicensing under\n+this license.\n+\n+ The precise terms and conditions for copying, distribution and\n+modification follow.\n+\n+ TERMS AND CONDITIONS\n+\n+ 0. Definitions.\n+\n+ "This License" refers to version 3 of the GNU Affero General Public License.\n+\n+ "Copyright" also means copyright-like laws that apply to other kinds of\n+works, such as semiconductor masks.\n+\n+ "The Program" refers to any copyrightable work licensed under this\n+License. Each licensee is addressed as "you". "Licensees" and\n+"recipients" may be individuals or organizations.\n+\n+ To "modify" a work means to copy from or adapt all or part of the work\n+in a fashion requiring copyright permission, other than the making of an\n+exact copy. The resulting work is called a "modified version" of the\n+earlier work or a work "based on" the earlier work.\n+\n+ A "covered work" means either the unmodified Program or a work based\n+on the Program.\n+\n+ To "propagate" a work means to do anything with it that, without\n+permission, would make you directly or secondarily liable for\n+infringement under applicable copyright law, except executing it on a\n+computer or mod'..b' any\n+author or copyright holder as a result of your choosing to follow a\n+later version.\n+\n+ 15. Disclaimer of Warranty.\n+\n+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\n+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\n+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY\n+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\n+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n+\n+ 16. Limitation of Liability.\n+\n+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\n+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\n+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\n+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\n+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\n+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\n+SUCH DAMAGES.\n+\n+ 17. Interpretation of Sections 15 and 16.\n+\n+ If the disclaimer of warranty and limitation of liability provided\n+above cannot be given local legal effect according to their terms,\n+reviewing courts shall apply local law that most closely approximates\n+an absolute waiver of all civil liability in connection with the\n+Program, unless a warranty or assumption of liability accompanies a\n+copy of the Program in return for a fee.\n+\n+ END OF TERMS AND CONDITIONS\n+\n+ How to Apply These Terms to Your New Programs\n+\n+ If you develop a new program, and you want it to be of the greatest\n+possible use to the public, the best way to achieve this is to make it\n+free software which everyone can redistribute and change under these terms.\n+\n+ To do so, attach the following notices to the program. It is safest\n+to attach them to the start of each source file to most effectively\n+state the exclusion of warranty; and each file should have at least\n+the "copyright" line and a pointer to where the full notice is found.\n+\n+ <one line to give the program\'s name and a brief idea of what it does.>\n+ Copyright (C) <year> <name of author>\n+\n+ This program is free software: you can redistribute it and/or modify\n+ it under the terms of the GNU Affero General Public License as published\n+ by the Free Software Foundation, either version 3 of the License, or\n+ (at your option) any later version.\n+\n+ This program is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ GNU Affero General Public License for more details.\n+\n+ You should have received a copy of the GNU Affero General Public License\n+ along with this program. If not, see <https://www.gnu.org/licenses/>.\n+\n+Also add information on how to contact you by electronic and paper mail.\n+\n+ If your software can interact with users remotely through a computer\n+network, you should also make sure that it provides a way for users to\n+get its source. For example, if your program is a web application, its\n+interface could display a "Source" link that leads users to an archive\n+of the code. There are many ways you could offer source, and different\n+solutions will be better for different programs; see section 13 for the\n+specific requirements.\n+\n+ You should also get your employer (if you work as a programmer) or school,\n+if any, to sign a "copyright disclaimer" for the program, if necessary.\n+For more information on this, and how to apply and follow the GNU AGPL, see\n+<https://www.gnu.org/licenses/>.\n' |
b |
diff -r 000000000000 -r bea08702ed51 README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Fri May 17 05:00:22 2019 -0400 |
b |
@@ -0,0 +1,2 @@ +# galaxy-mixomics-blocksplsda +Galaxy wrappers for the block.splsda, plotIndiv and plotVar functions from the mixOmics R package |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_blocksplsda.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_blocksplsda.xml Fri May 17 05:00:22 2019 -0400 |
[ |
b'@@ -0,0 +1,224 @@\n+<tool id="mixomics_blocksplsda" name="mixOmics block.splsda" version="0.1.0" profile="16.04" workflow_compatible="true">\n+\n+ <description>performs N-integration and feature selection with Projection to Latent Structures models (PLS) with sparse Discriminant Analysis</description>\n+ \n+ <requirements>\n+ <requirement type="package" version="6.8">bioconductor-mixomics</requirement>\n+ <requirement type="package" version="2.0">r-argparse</requirement>\n+ </requirements>\n+ \n+<!-- <stdio>\n+ <exit_code range="1:" level="fatal" />\n+ </stdio> -->\n+\n+ <command detect_errors="aggressive">\n+ <![CDATA[\n+ mkdir outdir\n+ && Rscript\n+ ${__tool_directory__}/mixomics_blocksplsda_script.R\n+ #for $b in $blocks\n+ --block\n+ #if $b.block_name\n+ ${b.block_name}\n+ #else\n+ ${b.data_matrix.name}\n+ #end if\n+ ${b.keep}\n+ ${b.data_matrix}\n+ ${b.variable_metadata}\n+ #end for\n+ --sample_metadata_in ${sample_metadata_in}\n+ --sample_description_col ${sample_description_col}\n+ --ncomp ${ncomp}\n+ ${correlation}\n+ --scheme ${adv.scheme}\n+ --mode ${adv.mode}\n+ --maxiter ${adv.maxiter}\n+ ${adv.scale}\n+ --init ${adv.init}\n+ --tol ${adv.tol}\n+ ${adv.nearzerovar}\n+ --rdata_out ${rdata_out}\n+ --sample_metadata_out ${sample_metadata_out}\n+ --variable_metadata_outdir outdir\n+ ]]>\n+ </command>\n+\n+ <inputs>\n+ <repeat name="blocks" title="Blocks">\n+ <param name="block_name" type="text" label="Block name" />\n+ <param name="keep" type="integer" value="0" min="0" label="Number of variables to select for each component" help="Default is to keep all variables" />\n+ <param name="data_matrix" type="data" format="tabular" label="Data matrix" help="rows = variables, columns = samples" />\n+ <param name="variable_metadata" type="data" format="tabular" optional="true" label="Variables metadata" help="rows = variables" />\n+ </repeat>\n+ <param name="sample_metadata_in" type="data" format="tabular" label="Samples metadata matrix" />\n+ <param name="sample_description_col" type="integer" value="0" min="0" label="Sample description column number" help="Use the last column by default" />\n+ <param name="ncomp" type="integer" value="2" min="1" label="Number of components to include in the model" />\n+ <param name="correlation" type="boolean" truevalue="--correlation" falsevalue="" checked="false" label="Correlation between all blocks"/>\n+ <section name="adv" title="Advanced Options" expanded="false">\n+ <param name="scheme" type="select" label="Scheme">\n+ <option value="horst" selected="true">horst</option>\n+ <option value="factorial" >factorial</option>\n+ <option value="centroid" >centroid</option>\n+ </param>\n+ <param name="mode" type="select" label="Mode">\n+ <option value="regression" selected="true">regression</option>\n+ <option value="canonical" >canonical</option>\n+ <option value="invariant" >invariant</option>\n+ <option value="classic" >classic</option>\n+ </param>\n+ <param name="maxiter" type="integer" value="100" min="1" label="Maximum number of iterations" />\n+ <param name="scale" type="boolean" truevalue="--scale" falsevalue="" checked="true" label="Scale" help="if checked, each block is standardized to zero means and unit variances" />\n+ <param name="init" type="select" label="Init">\n+ <option value="svd" selected="true">svd</option>\n+ <option value="svd.single" >svd.single</option>\n+ '..b' <test>\n+ <repeat name="blocks">\n+ <param name="block_name" value="Block1" />\n+ <param name="data_matrix" value="in_block1_data.tabular" />\n+ </repeat>\n+ <repeat name="blocks">\n+ <param name="block_name" value="Block2" />\n+ <param name="data_matrix" value="in_block2_data.tabular" />\n+ </repeat>\n+ <param name="sample_metadata_in" value="in_sample_meta.tabular" />\n+ <output name="rdata_out" value="out_rdata.rdata" />\n+ <output name="sample_metadata_out" value="out_sample_meta.tabular" />\n+ </test>\n+ </tests>\n+\n+ <help>\n+ <![CDATA[\n+.. class:: infomark\n+\n+**Authors** Pierre Pericard (pierre.pericard@pasteur-lille.fr)\n+\n+---------------------------------------------------\n+\n+.. class:: infomark\n+\n+**Please cite**\n+\n+Rohart F, Gautier B, Singh A, L\xc3\xaa Cao KA (2017) mixOmics: An R package for \xe2\x80\x98omics feature selection and multiple data integration.\n+PLOS Computational Biology 13(11): e1005752. https://doi.org/10.1371/journal.pcbi.1005752\n+\n+---------------------------------------------------\n+\n+======================\n+mixOmics blocks.splsda\n+======================\n+\n+-----------\n+Description\n+-----------\n+\n+The blocks.splsda function is part of the mixOmics package for exploration and integration of Omics datasets.\n+Performs N-integration and feature selection with Projection to Latent Structures models (PLS) with sparse Discriminant Analysis.\n+\n+-----------\n+Input files\n+-----------\n+\n+For each block (min 2 blocks):\n+==============================\n+\n++------------------------------+------------+\n+| Parameter : num + label | Format |\n++==============================+============+\n+| 1 : Data matrix | tabular |\n++------------------------------+------------+\n+| 2 : [opt] Variables metadata | tabular |\n++------------------------------+------------+\n+\n+Variables metadata files are optional.\n+If a file is provided, output metadata will be appended to the input file, otherwise a new output file will be created.\n+\n+Global input files:\n+===================\n+\n++-----------------------------+------------+\n+| Parameter : num + label | Format |\n++=============================+============+\n+| 1 : Samples metadata | tabular |\n++-----------------------------+------------+\n+\n+By default, the last column of the samples metadata matrix will be used as samples description factors.\n+If it\'s not the case, the column number can be inputed in the `Sample description column number` parameter.\n+\n+----------\n+Parameters\n+----------\n+\n+For each block (min 2 blocks):\n+==============================\n+\n+Block name\n+ Name of the block. If not provided, this will default to the input filename\n+\n+Number of variables to select for each component\n+ If set to 0 (default), all variables will be considered in the model\n+\n+Global parameters:\n+==================\n+\n+Sample description column number\n+\n+Number of components to include in the model\n+\n+Correlation between all blocks\n+\n+Advanced options:\n+=================\n+\n+Scheme\n+\n+Mode\n+\n+Maximum number of iterations\n+\n+Scale\n+\n+Init\n+\n+Convergence stopping value (tol)\n+\n+Near zero var\n+\n+------------\n+Output files\n+------------\n+\n+mixomics_blocksplsda_output.rdata\n+ | rData output\n+ | Contains the `mixomics_result` R object containing the result of the block.splsda function\n+\n+mixomics_blocksplsda_{input_sample_metadata_name}\n+ | tabular output\n+ | Identical to the input Sample metadata file with appended columns from the result of block.splsda function\n+\n+mixomics_blocksplsda_blocks_output\n+ A collection with the variable metadata output files (mixomics_blocksplsda_block_{block name}_variable_metadata) for each input block\n+\n+ ]]>\n+ </help>\n+\n+ <citations>\n+ <citation type="doi">10.1371/journal.pcbi.1005752</citation>\n+ </citations>\n+\n+</tool>\n\\ No newline at end of file\n' |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_blocksplsda_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_blocksplsda_script.R Fri May 17 05:00:22 2019 -0400 |
[ |
b'@@ -0,0 +1,213 @@\n+#!/usr/bin/env Rscript\n+\n+# Setup R error handling to go to stderr\n+options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )\n+\n+# we need that to not crash galaxy with an UTF8 error on German LC settings.\n+loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")\n+\n+## Get parameters ##\n+suppressPackageStartupMessages(require(argparse))\n+\n+parser <- ArgumentParser(description=\'Run the mixOmics block.splsda function\')\n+\n+parser$add_argument(\'--block\', dest=\'blocks_list\', nargs=4, action="append", required=TRUE, help="Block name + nb variables to select + data matrix file + variables metadata file")\n+parser$add_argument(\'--sample_metadata_in\', dest=\'sample_metadata_in\', required=TRUE, help="Samples metadata file")\n+parser$add_argument(\'--sample_description_col\', dest=\'sample_description_col\', type=\'integer\', required=TRUE, help="Sample description column number")\n+parser$add_argument(\'--ncomp\', dest=\'ncomp\', type=\'integer\', required=TRUE, help="Number of components to include in the model")\n+parser$add_argument(\'--correlation\', dest=\'correlation\', action="store_true", help="Add correlation between all blocks")\n+parser$add_argument(\'--scheme\', dest=\'scheme\', required=TRUE, help="Scheme")\n+parser$add_argument(\'--mode\', dest=\'mode\', required=TRUE, help="Mode")\n+parser$add_argument(\'--maxiter\', dest=\'maxiter\', type=\'integer\', required=TRUE, help="Maximum number of iterations")\n+parser$add_argument(\'--scale\', dest=\'scale\', action="store_true", help="Each block is standardized to zero means and unit variances")\n+parser$add_argument(\'--init\', dest=\'init\', required=TRUE, help="Init (svd or svd.single)")\n+parser$add_argument(\'--tol\', dest=\'tol\', type=\'double\', required=TRUE, help="Convergence stopping value")\n+parser$add_argument(\'--nearzerovar\', dest=\'nearzerovar\', action="store_true", help="Should be set in particular for data with many zero values")\n+parser$add_argument(\'--rdata_out\', dest=\'rdata_out\', required=TRUE, help="Output Rdata file")\n+parser$add_argument(\'--sample_metadata_out\', dest=\'sample_metadata_out\', required=TRUE, help="Output sample metadata file")\n+parser$add_argument(\'--variable_metadata_outdir\', dest=\'variable_metadata_outdir\', required=TRUE, help="Output variable metadata directory")\n+\n+args <- parser$parse_args()\n+\n+## Print parameters\n+print("Blocks:")\n+print(args$blocks_list)\n+print("Sample metadata file:")\n+print(args$sample_metadata_in)\n+print("Sample description column number:")\n+print(args$sample_description_col)\n+print("Number of components:")\n+print(args$ncomp)\n+print("Compute correlation between all blocks:")\n+print(args$correlation)\n+print("Scheme:")\n+print(args$scheme)\n+print("Mode:")\n+print(args$mode)\n+print("Max nb of iterations:")\n+print(args$maxiter)\n+print("Scale:")\n+print(args$scale)\n+print("Tol:")\n+print(args$tol)\n+print("near.zero.var:")\n+print(args$nearzerovar)\n+print("Output Rdata file:")\n+print(args$rdata_out)\n+print("Output sample metadata file:")\n+print(args$sample_metadata_out)\n+print("Output variable metadata directory:")\n+print(args$variable_metadata_outdir)\n+\n+## Loading libraries\n+suppressPackageStartupMessages(require(mixOmics))\n+\n+## Read sample metadata file and set description factor matrix\n+sample_metadata <- read.table(args$sample_metadata_in, sep=\'\\t\', header=TRUE, row.names=1)\n+sample_metadata_names <- row.names(sample_metadata)\n+# print(sample_metadata_names)\n+\n+# print("Sample metadata matrix:")\n+# print(head(sample_metadata))\n+\n+description_column <- ncol(sample_metadata)\n+if(args$sample_description_col > 0)\n+{\n+ description_column <- args$sample_description_col\n+}\n+\n+Y <- factor(sample_metadata[[description_column]])\n+\n+print("Y factor matrix:")\n+print(Y)\n+\n+## Read and prepare block datasets\n+list_X <- c()\n+keepX <- c()\n+\n+for(i in 1:nrow(args$blocks_list))\n+{\n+ # Read block input parameters\n+ block_name <- args$blocks_list[i,1]\n+ block_keep <- strtoi(args$blocks_list[i,2])\n+ block_data_ma'..b'ock_data_matrix_names <- row.names(block_data_matrix)\n+ # print(block_data_matrix_names)\n+\n+ if(!identical(sample_metadata_names, block_data_matrix_names))\n+ {\n+ stop("Sample names must be the same and in the same order in the sample metadata matrix and the block data matrix")\n+ }\n+\n+ list_X[[block_name]] <- block_data_matrix\n+\n+ # Set the nb of variables to keep\n+ nb_variables = ncol(list_X[[block_name]])\n+ if(block_keep > 0)\n+ {\n+ keepX[[block_name]] <- rep(block_keep, args$ncomp)\n+ }\n+ else\n+ {\n+ keepX[[block_name]] <- rep(nb_variables, args$ncomp)\n+ }\n+ print(sprintf("Block %s contains %d variables and %d will be selected", block_name, nb_variables, block_keep))\n+}\n+\n+# print(list_X)\n+\n+## Generate design matrix\n+block_nb <- nrow(args$blocks_list)\n+\n+design <- matrix(0, nrow = block_nb, ncol = block_nb)\n+\n+if(args$correlation)\n+{\n+ design <- matrix(1, nrow = block_nb, ncol = block_nb)\n+ diag(design) <- 0\n+}\n+\n+# print("Design matrix:")\n+# print(design)\n+\n+###################\n+## Main function ##\n+###################\n+\n+mixomics_result <- block.splsda(X = list_X,\n+ Y = Y,\n+ ncomp = args$ncomp,\n+ keepX = keepX,\n+ design = design,\n+ scheme = args$scheme,\n+ mode = args$mode,\n+ scale = args$scale,\n+ init = args$init,\n+ tol = args$tol,\n+ max.iter = args$maxiter,\n+ near.zero.var = args$nearzerovar,\n+ all.outputs = TRUE)\n+\n+print("Block.splsda object:")\n+print(mixomics_result)\n+\n+## Save output Rdata file\n+save(mixomics_result, file=args$rdata_out)\n+\n+## Save output sample metadata file\n+# print("Block.splsda variates:")\n+# print(mixomics_result$variates)\n+\n+for(bname in names(mixomics_result$variates))\n+{\n+ # print(bname)\n+ # print(mixomics_result$variates[[bname]])\n+\n+ # Format the column names to add the block name and replace spaces\n+ colnames(mixomics_result$variates[[bname]]) <- paste("block.splsda", bname, gsub(" ", "_", colnames(mixomics_result$variates[[bname]])), sep = "_")\n+ # print(mixomics_result$variates[[bname]])\n+\n+ # Append the new columns to the sample metadata matrix\n+ sample_metadata <- cbind2(sample_metadata, mixomics_result$variates[[bname]])\n+}\n+\n+# print(sample_metadata)\n+\n+write.table(sample_metadata, file = args$sample_metadata_out, quote = TRUE, sep = "\\t", row.names = TRUE, col.names = NA)\n+\n+## Save output variable metadata files in output directory\n+# print("Block.splsda loadings:")\n+# print(mixomics_result$loadings)\n+\n+for(i in 1:nrow(args$blocks_list))\n+{\n+ # Read again block input parameters\n+ block_name <- args$blocks_list[i,1]\n+ # block_keep <- strtoi(args$blocks_list[i,2])\n+ # block_data_matrix_filename <- args$blocks_list[i,3]\n+ block_meta_var <- args$blocks_list[i,4]\n+\n+ meta_variable <- mixomics_result$loadings[[block_name]]\n+ # print(head(meta_variable))\n+\n+ # Read input block variable metadata files if provided (optional)\n+ if(block_meta_var != "None")\n+ {\n+ input_meta_variable <- read.table(block_meta_var, sep=\'\\t\', header=TRUE, row.names=1)\n+ # print(head(input_meta_variable))\n+\n+ # Append the new columns to the variable metadata matrix\n+ meta_variable <- cbind2(input_meta_variable, meta_variable)\n+ }\n+\n+ # print(head(meta_variable))\n+\n+ block_meta_var_output_filename <- paste("mixomics_blocksplsda_block_", block_name, "_variable_metadata.tsv", sep="")\n+ 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)\n+}\n\\ No newline at end of file\n' |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_plotindiv.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_plotindiv.xml Fri May 17 05:00:22 2019 -0400 |
[ |
@@ -0,0 +1,107 @@ +<tool id="mixomics_plotindiv" name="mixOmics plotIndiv" version="0.1.0" profile="16.04" workflow_compatible="true"> + + <description>provides scatter plots for individuals (experimental units) representation in (sparse)(I)PCA,(regularized)CCA, (sparse)PLS(DA) and (sparse)(R)GCCA(DA)</description> + + <requirements> + <requirement type="package" version="6.8">bioconductor-mixomics</requirement> + <requirement type="package" version="2.0">r-argparse</requirement> + </requirements> + + <stdio> + <!-- <exit_code range="1:" level="fatal" /> --> + </stdio> + + <command detect_errors="aggressive"> + <![CDATA[ + Rscript + ${__tool_directory__}/mixomics_plotindiv_script.R + --input_rdata $input_rdata + $adv.legend + $adv.ellipse + --output_pdf $output_pdf + ]]> + </command> + + <inputs> + <param name="input_rdata" type="data" format="rdata" label="Input RData file from (sparse)(I)PCA, (regularized)CCA, (sparse)PLS(DA) or (sparse)(R)GCCA(DA)"/> + <section name="adv" title="Advanced Options" expanded="false"> + <param name="legend" type="boolean" checked="true" truevalue="--legend" falsevalue="" label="Plot legend"/> + <param name="ellipse" type="boolean" checked="true" truevalue="--ellipse" falsevalue="" label="Plot ellipse plots"/> + </section> + </inputs> + + <outputs> + <data name="output_pdf" format="pdf" label="plotIndiv.pdf" /> + </outputs> + + <tests> + <test> + <param name="input_rdata" value="out_rdata.rdata" /> + <output name="output_pdf" value="out_plotIndiv.pdf" /> + </test> + </tests> + + <help> + <![CDATA[ +.. class:: infomark + +**Authors** Pierre Pericard (pierre.pericard@pasteur-lille.fr) + +--------------------------------------------------- + +.. class:: infomark + +**Please cite** + +Rohart F, Gautier B, Singh A, Lê Cao KA (2017) mixOmics: An R package for ‘omics feature selection and multiple data integration. +PLOS Computational Biology 13(11): e1005752. https://doi.org/10.1371/journal.pcbi.1005752 + +--------------------------------------------------- + +================== +mixOmics plotIndiv +================== + +----------- +Description +----------- + +The plotIndiv function is part of the mixOmics package for exploration and integration of Omics datasets. +Provides scatter plots for individuals (experimental units) representation in (sparse)(I)PCA,(regularized)CCA, (sparse)PLS(DA) and (sparse)(R)GCCA(DA). + +----------- +Input files +----------- + ++-------------------------------+------------+ +| Parameter : num + label | Format | ++===============================+============+ +| 1 : Rdata block.splsda output | Rdata | ++-------------------------------+------------+ + +---------- +Parameters +---------- + +Advanced options: +================= + +Plot legend + +Plot ellipse plots + +------------ +Output files +------------ + +plotIndiv.pdf + A pdf file with scatter plots for individuals + + ]]> + </help> + + <citations> + <citation type="doi">10.1371/journal.pcbi.1005752</citation> + </citations> + +</tool> \ No newline at end of file |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_plotindiv_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_plotindiv_script.R Fri May 17 05:00:22 2019 -0400 |
[ |
@@ -0,0 +1,53 @@ +#!/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") + +## Main Function ## + +suppressPackageStartupMessages(require(argparse)) + +parser <- ArgumentParser(description='Run the mixOmics plotIndiv function') + +parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file") +parser$add_argument('--legend', dest='legend', action="store_true", help="Display the legend") +parser$add_argument('--ellipse', dest='ellipse', action="store_true", help="Plot ellipse plots") +parser$add_argument('--output_pdf', dest='output_pdf', required=TRUE, help="Output PDF file") + +args <- parser$parse_args() + +## +print("Input RData:") +print(args$input_rdata) +print("Plot legend:") +print(args$legend) +print("Plot ellipse plots:") +print(args$ellipse) +print("Output PDF file:") +print(args$output_pdf) + +# loading libraries +suppressPackageStartupMessages(require(mixOmics)) + +load(args$input_rdata) + +pdf(args$output_pdf) + +plotIndiv(mixomics_result, + legend = args$legend, + ellipse = args$ellipse) + +for(k in 1:(length(mixomics_result$names[[3]])-1)) +{ + name_block = mixomics_result$names[[3]][k] + + plotIndiv(mixomics_result, + blocks = k, + legend = args$legend, + ellipse = args$ellipse) +} + +dev.off() \ No newline at end of file |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_plotvar.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_plotvar.xml Fri May 17 05:00:22 2019 -0400 |
[ |
@@ -0,0 +1,107 @@ +<tool id="mixomics_plotvar" name="mixOmics plotVar" version="0.1.0" profile="16.04" workflow_compatible="true"> + + <description>provides variables representation for (regularized) CCA, (sparse) PLS regression, PCA and (sparse) Regularized generalised CCA</description> + + <requirements> + <requirement type="package" version="6.8">bioconductor-mixomics</requirement> + <requirement type="package" version="2.0">r-argparse</requirement> + </requirements> + + <stdio> + <!-- <exit_code range="1:" level="fatal" /> --> + </stdio> + + <command detect_errors="aggressive"> + <![CDATA[ + Rscript + ${__tool_directory__}/mixomics_plotvar_script.R + --input_rdata $input_rdata + $adv.legend + --cutoff $adv.cutoff + --output_pdf $output_pdf + ]]> + </command> + + <inputs> + <param name="input_rdata" type="data" format="rdata" label="Input RData file from (sparse)(I)PCA, (regularized)CCA, (sparse)PLS(DA) or (sparse)(R)GCCA(DA)"/> + <section name="adv" title="Advanced Options" expanded="false"> + <param name="legend" type="boolean" checked="true" truevalue="--legend" falsevalue="" label="Plot legend"/> + <param name="cutoff" type="float" value="0.85" min="0" max="1" label="Cut-off" /> + </section> + </inputs> + + <outputs> + <data name="output_pdf" format="pdf" label="plotVar.pdf" /> + </outputs> + + <tests> + <test> + <param name="input_rdata" value="out_rdata.rdata" /> + <output name="output_pdf" value="out_plotVar.pdf" /> + </test> + </tests> + + <help> + <![CDATA[ +.. class:: infomark + +**Authors** Pierre Pericard (pierre.pericard@pasteur-lille.fr) + +--------------------------------------------------- + +.. class:: infomark + +**Please cite** + +Rohart F, Gautier B, Singh A, Lê Cao KA (2017) mixOmics: An R package for ‘omics feature selection and multiple data integration. +PLOS Computational Biology 13(11): e1005752. https://doi.org/10.1371/journal.pcbi.1005752 + +--------------------------------------------------- + +================ +mixOmics plotVar +================ + +----------- +Description +----------- + +The plotVar function is part of the mixOmics package for exploration and integration of Omics datasets. +Provides variables representation for (regularized) CCA, (sparse) PLS regression, PCA and (sparse) Regularized generalised CCA. + +----------- +Input files +----------- + ++-------------------------------+------------+ +| Parameter : num + label | Format | ++===============================+============+ +| 1 : Rdata block.splsda output | Rdata | ++-------------------------------+------------+ + +---------- +Parameters +---------- + +Advanced options: +================= + +Plot legend + +Cut-off + +------------ +Output files +------------ + +plotIndiv.pdf + A pdf file with scatter plots for individuals + + ]]> + </help> + + <citations> + <citation type="doi">10.1371/journal.pcbi.1005752</citation> + </citations> + +</tool> \ No newline at end of file |
b |
diff -r 000000000000 -r bea08702ed51 mixomics_plotvar_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mixomics_plotvar_script.R Fri May 17 05:00:22 2019 -0400 |
[ |
@@ -0,0 +1,53 @@ +#!/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") + +## Main Function ## + +suppressPackageStartupMessages(require(argparse)) + +parser <- ArgumentParser(description='Run the mixOmics plotVar function') + +parser$add_argument('--input_rdata', dest='input_rdata', required=TRUE, help="Input RData file") +parser$add_argument('--legend', dest='legend', action="store_true", help="Display the legend") +parser$add_argument('--cutoff', dest='cutoff', type='double', required=TRUE, help="Cutoff (0..1)") +parser$add_argument('--output_pdf', dest='output_pdf', required=TRUE, help="Output PDF file") + +args <- parser$parse_args() + +## +print("Input RData:") +print(args$input_rdata) +print("Plot legend:") +print(args$legend) +print("Cutoff:") +print(args$cutoff) +print("Output PDF file:") +print(args$output_pdf) + +# loading libraries +suppressPackageStartupMessages(require(mixOmics)) + +load(args$input_rdata) + +pdf(args$output_pdf) + +plotVar(mixomics_result, + legend = args$legend, + cutoff = args$cutoff) + +for(k in 1:(length(mixomics_result$names[[3]])-1)) +{ + name_block = mixomics_result$names[[3]][k] + + plotVar(mixomics_result, + blocks = k, + legend = args$legend, + cutoff = args$cutoff) +} + +dev.off() \ No newline at end of file |
b |
diff -r 000000000000 -r bea08702ed51 test-data/in_block1_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/in_block1_data.tabular Fri May 17 05:00:22 2019 -0400 |
b |
@@ -0,0 +1,7 @@ + "A1" "A2" "B1" "B2" +"var1" 1 2 3 4 +"var2" 1.5 2.5 3.5 4.5 +"var3" 2.5 2 2.5 2 +"var4" 5 4 3 2 +"var5" 1.001 1.01 1.1 1 +"var6" 10 13 11 10 |
b |
diff -r 000000000000 -r bea08702ed51 test-data/in_block2_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/in_block2_data.tabular Fri May 17 05:00:22 2019 -0400 |
b |
@@ -0,0 +1,7 @@ + "A1" "A2" "B1" "B2" +"var1" 2 3 4 5 +"var2" 2.5 1 2.5 4 +"var3" 2.5 2 2.5 2 +"var4" 6 5 3 2 +"var5" 10.001 10.01 10.1 10 +"var6" 20 23 21 20 |
b |
diff -r 000000000000 -r bea08702ed51 test-data/in_sample_meta.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/in_sample_meta.tabular Fri May 17 05:00:22 2019 -0400 |
b |
@@ -0,0 +1,5 @@ + "Y" +"A1" "catA" +"A2" "catA" +"B1" "catB" +"B2" "catB" |
b |
diff -r 000000000000 -r bea08702ed51 test-data/out_plotIndiv.pdf |
b |
Binary file test-data/out_plotIndiv.pdf has changed |
b |
diff -r 000000000000 -r bea08702ed51 test-data/out_plotVar.pdf |
b |
Binary file test-data/out_plotVar.pdf has changed |
b |
diff -r 000000000000 -r bea08702ed51 test-data/out_rdata.rdata |
b |
Binary file test-data/out_rdata.rdata has changed |
b |
diff -r 000000000000 -r bea08702ed51 test-data/out_sample_meta.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out_sample_meta.tabular Fri May 17 05:00:22 2019 -0400 |
b |
@@ -0,0 +1,5 @@ +"" "Y" "block.splsda_Block1_comp1" "block.splsda_Block1_comp2" "block.splsda_Block2_comp1" "block.splsda_Block2_comp2" "block.splsda_Y_comp1" "block.splsda_Y_comp2" +"A1" "catA" 1.85013467343542 0.422684485040581 1.28016568038406 0.405956759170116 1.22474487139159 0.0342790721507239 +"A2" "catA" 1.07324868851916 -0.960001503242697 1.53872954309497 -0.749531756995324 1.22474487139159 -0.16259622770647 +"B1" "catB" -1.0856729590951 1.64317643604658 -1.01949098398762 1.60513370686125 -1.22474487139159 0.374128476201717 +"B2" "catB" -1.83771040285949 -1.10585941784446 -1.79940423949142 -1.26155870903602 -1.22474487139159 -0.245811320645977 |