changeset 0:ab2ee3414e4e draft

planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 98e8f4464b2f7321acb010e26e2a1c82fe37096e
author ethevenot
date Tue, 24 Oct 2017 08:57:25 -0400
parents
children c00848a8e302
files LICENSE.md README.md build.xml runit/example1/dataMatrix.tsv runit/example1/sampleMetadata.tsv runit/example1/variableMetadata.tsv runit/input/dataMatrix.tsv runit/input/sampleMetadata.tsv runit/input/variableMetadata.tsv runit/output/figure.pdf runit/output/information.txt runit/output/variableMetadata.tsv runit/univariate_runtests.R runit/univariate_tests.R static/images/univariate_workflowPositionImage.png test-data/dataMatrix.tsv test-data/output-variableMetadata.tsv test-data/sampleMetadata.tsv test-data/variableMetadata.tsv test/.gitignore test/test-univ univariate_config.xml univariate_script.R univariate_wrapper.R
diffstat 24 files changed, 1881 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.md	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,517 @@
+  CeCILL FREE SOFTWARE LICENSE AGREEMENT
+
+Version 2.1 dated 2013-06-21
+
+
+    Notice
+
+This Agreement is a Free Software license agreement that is the result
+of discussions between its authors in order to ensure compliance with
+the two main principles guiding its drafting:
+
+  * firstly, compliance with the principles governing the distribution
+    of Free Software: access to source code, broad rights granted to users,
+  * secondly, the election of a governing law, French law, with which it
+    is conformant, both as regards the law of torts and intellectual
+    property law, and the protection that it offers to both authors and
+    holders of the economic rights over software.
+
+The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) 
+license are: 
+
+Commissariat à l'énergie atomique et aux énergies alternatives - CEA, a
+public scientific, technical and industrial research establishment,
+having its principal place of business at 25 rue Leblanc, immeuble Le
+Ponant D, 75015 Paris, France.
+
+Centre National de la Recherche Scientifique - CNRS, a public scientific
+and technological establishment, having its principal place of business
+at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
+
+Institut National de Recherche en Informatique et en Automatique -
+Inria, a public scientific and technological establishment, having its
+principal place of business at Domaine de Voluceau, Rocquencourt, BP
+105, 78153 Le Chesnay cedex, France.
+
+
+    Preamble
+
+The purpose of this Free Software license agreement is to grant users
+the right to modify and redistribute the software governed by this
+license within the framework of an open source distribution model.
+
+The exercising of this right is conditional upon certain obligations for
+users so as to preserve this status for all subsequent redistributions.
+
+In consideration of access to the source code and the rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty and the software's author, the holder of the
+economic rights, and the successive licensors only have limited liability.
+
+In this respect, the risks associated with loading, using, modifying
+and/or developing or reproducing the software by the user are brought to
+the user's attention, given its Free Software status, which may make it
+complicated to use, with the result that its use is reserved for
+developers and experienced professionals having in-depth computer
+knowledge. Users are therefore encouraged to load and test the
+suitability of the software as regards their requirements in conditions
+enabling the security of their systems and/or data to be ensured and,
+more generally, to use and operate it in the same conditions of
+security. This Agreement may be freely reproduced and published,
+provided it is not altered, and that no provisions are either added or
+removed herefrom.
+
+This Agreement may apply to any or all software for which the holder of
+the economic rights decides to submit the use thereof to its provisions.
+
+Frequently asked questions can be found on the official website of the
+CeCILL licenses family (http://www.cecill.info/index.en.html) for any 
+necessary clarification.
+
+
+    Article 1 - DEFINITIONS
+
+For the purpose of this Agreement, when the following expressions
+commence with a capital letter, they shall have the following meaning:
+
+Agreement: means this license agreement, and its possible subsequent
+versions and annexes.
+
+Software: means the software in its Object Code and/or Source Code form
+and, where applicable, its documentation, "as is" when the Licensee
+accepts the Agreement.
+
+Initial Software: means the Software in its Source Code and possibly its
+Object Code form and, where applicable, its documentation, "as is" when
+it is first distributed under the terms and conditions of the Agreement.
+
+Modified Software: means the Software modified by at least one
+Contribution.
+
+Source Code: means all the Software's instructions and program lines to
+which access is required so as to modify the Software.
+
+Object Code: means the binary files originating from the compilation of
+the Source Code.
+
+Holder: means the holder(s) of the economic rights over the Initial
+Software.
+
+Licensee: means the Software user(s) having accepted the Agreement.
+
+Contributor: means a Licensee having made at least one Contribution.
+
+Licensor: means the Holder, or any other individual or legal entity, who
+distributes the Software under the Agreement.
+
+Contribution: means any or all modifications, corrections, translations,
+adaptations and/or new functions integrated into the Software by any or
+all Contributors, as well as any or all Internal Modules.
+
+Module: means a set of sources files including their documentation that
+enables supplementary functions or services in addition to those offered
+by the Software.
+
+External Module: means any or all Modules, not derived from the
+Software, so that this Module and the Software run in separate address
+spaces, with one calling the other when they are run.
+
+Internal Module: means any or all Module, connected to the Software so
+that they both execute in the same address space.
+
+GNU GPL: means the GNU General Public License version 2 or any
+subsequent version, as published by the Free Software Foundation Inc.
+
+GNU Affero GPL: means the GNU Affero General Public License version 3 or
+any subsequent version, as published by the Free Software Foundation Inc.
+
+EUPL: means the European Union Public License version 1.1 or any
+subsequent version, as published by the European Commission.
+
+Parties: mean both the Licensee and the Licensor.
+
+These expressions may be used both in singular and plural form.
+
+
+    Article 2 - PURPOSE
+
+The purpose of the Agreement is the grant by the Licensor to the
+Licensee of a non-exclusive, transferable and worldwide license for the
+Software as set forth in Article 5 <#scope> hereinafter for the whole
+term of the protection granted by the rights over said Software.
+
+
+    Article 3 - ACCEPTANCE
+
+3.1 The Licensee shall be deemed as having accepted the terms and
+conditions of this Agreement upon the occurrence of the first of the
+following events:
+
+  * (i) loading the Software by any or all means, notably, by
+    downloading from a remote server, or by loading from a physical medium;
+  * (ii) the first time the Licensee exercises any of the rights granted
+    hereunder.
+
+3.2 One copy of the Agreement, containing a notice relating to the
+characteristics of the Software, to the limited warranty, and to the
+fact that its use is restricted to experienced users has been provided
+to the Licensee prior to its acceptance as set forth in Article 3.1
+<#accepting> hereinabove, and the Licensee hereby acknowledges that it
+has read and understood it.
+
+
+    Article 4 - EFFECTIVE DATE AND TERM
+
+
+      4.1 EFFECTIVE DATE
+
+The Agreement shall become effective on the date when it is accepted by
+the Licensee as set forth in Article 3.1 <#accepting>.
+
+
+      4.2 TERM
+
+The Agreement shall remain in force for the entire legal term of
+protection of the economic rights over the Software.
+
+
+    Article 5 - SCOPE OF RIGHTS GRANTED
+
+The Licensor hereby grants to the Licensee, who accepts, the following
+rights over the Software for any or all use, and for the term of the
+Agreement, on the basis of the terms and conditions set forth hereinafter.
+
+Besides, if the Licensor owns or comes to own one or more patents
+protecting all or part of the functions of the Software or of its
+components, the Licensor undertakes not to enforce the rights granted by
+these patents against successive Licensees using, exploiting or
+modifying the Software. If these patents are transferred, the Licensor
+undertakes to have the transferees subscribe to the obligations set
+forth in this paragraph.
+
+
+      5.1 RIGHT OF USE
+
+The Licensee is authorized to use the Software, without any limitation
+as to its fields of application, with it being hereinafter specified
+that this comprises:
+
+ 1. permanent or temporary reproduction of all or part of the Software
+    by any or all means and in any or all form.
+
+ 2. loading, displaying, running, or storing the Software on any or all
+    medium.
+
+ 3. entitlement to observe, study or test its operation so as to
+    determine the ideas and principles behind any or all constituent
+    elements of said Software. This shall apply when the Licensee
+    carries out any or all loading, displaying, running, transmission or
+    storage operation as regards the Software, that it is entitled to
+    carry out hereunder.
+
+
+      5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
+
+The right to make Contributions includes the right to translate, adapt,
+arrange, or make any or all modifications to the Software, and the right
+to reproduce the resulting software.
+
+The Licensee is authorized to make any or all Contributions to the
+Software provided that it includes an explicit notice that it is the
+author of said Contribution and indicates the date of the creation thereof.
+
+
+      5.3 RIGHT OF DISTRIBUTION
+
+In particular, the right of distribution includes the right to publish,
+transmit and communicate the Software to the general public on any or
+all medium, and by any or all means, and the right to market, either in
+consideration of a fee, or free of charge, one or more copies of the
+Software by any means.
+
+The Licensee is further authorized to distribute copies of the modified
+or unmodified Software to third parties according to the terms and
+conditions set forth hereinafter.
+
+
+        5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
+
+The Licensee is authorized to distribute true copies of the Software in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's warranty
+    and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Software is
+redistributed, the Licensee allows effective access to the full Source
+Code of the Software for a period of at least three years from the
+distribution of the Software, it being understood that the additional
+acquisition cost of the Source Code shall not exceed the cost of the
+data transfer.
+
+
+        5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
+
+When the Licensee makes a Contribution to the Software, the terms and
+conditions for the distribution of the resulting Modified Software
+become subject to all the provisions of this Agreement.
+
+The Licensee is authorized to distribute the Modified Software, in
+source code or object code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's warranty
+    and liability as set forth in Articles 8 and 9,
+
+and, in the event that only the object code of the Modified Software is
+redistributed,
+
+ 3. a note stating the conditions of effective access to the full source
+    code of the Modified Software for a period of at least three years
+    from the distribution of the Modified Software, it being understood
+    that the additional acquisition cost of the source code shall not
+    exceed the cost of the data transfer.
+
+
+        5.3.3 DISTRIBUTION OF EXTERNAL MODULES
+
+When the Licensee has developed an External Module, the terms and
+conditions of this Agreement do not apply to said External Module, that
+may be distributed under a separate license agreement.
+
+
+        5.3.4 COMPATIBILITY WITH OTHER LICENSES
+
+The Licensee can include a code that is subject to the provisions of one
+of the versions of the GNU GPL, GNU Affero GPL and/or EUPL in the
+Modified or unmodified Software, and distribute that entire code under
+the terms of the same version of the GNU GPL, GNU Affero GPL and/or EUPL.
+
+The Licensee can include the Modified or unmodified Software in a code
+that is subject to the provisions of one of the versions of the GNU GPL,
+GNU Affero GPL and/or EUPL and distribute that entire code under the
+terms of the same version of the GNU GPL, GNU Affero GPL and/or EUPL.
+
+
+    Article 6 - INTELLECTUAL PROPERTY
+
+
+      6.1 OVER THE INITIAL SOFTWARE
+
+The Holder owns the economic rights over the Initial Software. Any or
+all use of the Initial Software is subject to compliance with the terms
+and conditions under which the Holder has elected to distribute its work
+and no one shall be entitled to modify the terms and conditions for the
+distribution of said Initial Software.
+
+The Holder undertakes that the Initial Software will remain ruled at
+least by this Agreement, for the duration set forth in Article 4.2 <#term>.
+
+
+      6.2 OVER THE CONTRIBUTIONS
+
+The Licensee who develops a Contribution is the owner of the
+intellectual property rights over this Contribution as defined by
+applicable law.
+
+
+      6.3 OVER THE EXTERNAL MODULES
+
+The Licensee who develops an External Module is the owner of the
+intellectual property rights over this External Module as defined by
+applicable law and is free to choose the type of agreement that shall
+govern its distribution.
+
+
+      6.4 JOINT PROVISIONS
+
+The Licensee expressly undertakes:
+
+ 1. not to remove, or modify, in any manner, the intellectual property
+    notices attached to the Software;
+
+ 2. to reproduce said notices, in an identical manner, in the copies of
+    the Software modified or not.
+
+The Licensee undertakes not to directly or indirectly infringe the
+intellectual property rights on the Software of the Holder and/or
+Contributors, and to take, where applicable, vis-à-vis its staff, any
+and all measures required to ensure respect of said intellectual
+property rights of the Holder and/or Contributors.
+
+
+    Article 7 - RELATED SERVICES
+
+7.1 Under no circumstances shall the Agreement oblige the Licensor to
+provide technical assistance or maintenance services for the Software.
+
+However, the Licensor is entitled to offer this type of services. The
+terms and conditions of such technical assistance, and/or such
+maintenance, shall be set forth in a separate instrument. Only the
+Licensor offering said maintenance and/or technical assistance services
+shall incur liability therefor.
+
+7.2 Similarly, any Licensor is entitled to offer to its licensees, under
+its sole responsibility, a warranty, that shall only be binding upon
+itself, for the redistribution of the Software and/or the Modified
+Software, under terms and conditions that it is free to decide. Said
+warranty, and the financial terms and conditions of its application,
+shall be subject of a separate instrument executed between the Licensor
+and the Licensee.
+
+
+    Article 8 - LIABILITY
+
+8.1 Subject to the provisions of Article 8.2, the Licensee shall be
+entitled to claim compensation for any direct loss it may have suffered
+from the Software as a result of a fault on the part of the relevant
+Licensor, subject to providing evidence thereof.
+
+8.2 The Licensor's liability is limited to the commitments made under
+this Agreement and shall not be incurred as a result of in particular:
+(i) loss due the Licensee's total or partial failure to fulfill its
+obligations, (ii) direct or consequential loss that is suffered by the
+Licensee due to the use or performance of the Software, and (iii) more
+generally, any consequential loss. In particular the Parties expressly
+agree that any or all pecuniary or business loss (i.e. loss of data,
+loss of profits, operating loss, loss of customers or orders,
+opportunity cost, any disturbance to business activities) or any or all
+legal proceedings instituted against the Licensee by a third party,
+shall constitute consequential loss and shall not provide entitlement to
+any or all compensation from the Licensor.
+
+
+    Article 9 - WARRANTY
+
+9.1 The Licensee acknowledges that the scientific and technical
+state-of-the-art when the Software was distributed did not enable all
+possible uses to be tested and verified, nor for the presence of
+possible defects to be detected. In this respect, the Licensee's
+attention has been drawn to the risks associated with loading, using,
+modifying and/or developing and reproducing the Software which are
+reserved for experienced users.
+
+The Licensee shall be responsible for verifying, by any or all means,
+the suitability of the product for its requirements, its good working
+order, and for ensuring that it shall not cause damage to either persons
+or properties.
+
+9.2 The Licensor hereby represents, in good faith, that it is entitled
+to grant all the rights over the Software (including in particular the
+rights set forth in Article 5 <#scope>).
+
+9.3 The Licensee acknowledges that the Software is supplied "as is" by
+the Licensor without any other express or tacit warranty, other than
+that provided for in Article 9.2 <#good-faith> and, in particular,
+without any warranty as to its commercial value, its secured, safe,
+innovative or relevant nature.
+
+Specifically, the Licensor does not warrant that the Software is free
+from any error, that it will operate without interruption, that it will
+be compatible with the Licensee's own equipment and software
+configuration, nor that it will meet the Licensee's requirements.
+
+9.4 The Licensor does not either expressly or tacitly warrant that the
+Software does not infringe any third party intellectual property right
+relating to a patent, software or any other property right. Therefore,
+the Licensor disclaims any and all liability towards the Licensee
+arising out of any or all proceedings for infringement that may be
+instituted in respect of the use, modification and redistribution of the
+Software. Nevertheless, should such proceedings be instituted against
+the Licensee, the Licensor shall provide it with technical and legal
+expertise for its defense. Such technical and legal expertise shall be
+decided on a case-by-case basis between the relevant Licensor and the
+Licensee pursuant to a memorandum of understanding. The Licensor
+disclaims any and all liability as regards the Licensee's use of the
+name of the Software. No warranty is given as regards the existence of
+prior rights over the name of the Software or as regards the existence
+of a trademark.
+
+
+    Article 10 - TERMINATION
+
+10.1 In the event of a breach by the Licensee of its obligations
+hereunder, the Licensor may automatically terminate this Agreement
+thirty (30) days after notice has been sent to the Licensee and has
+remained ineffective.
+
+10.2 A Licensee whose Agreement is terminated shall no longer be
+authorized to use, modify or distribute the Software. However, any
+licenses that it may have granted prior to termination of the Agreement
+shall remain valid subject to their having been granted in compliance
+with the terms and conditions hereof.
+
+
+    Article 11 - MISCELLANEOUS
+
+
+      11.1 EXCUSABLE EVENTS
+
+Neither Party shall be liable for any or all delay, or failure to
+perform the Agreement, that may be attributable to an event of force
+majeure, an act of God or an outside cause, such as defective
+functioning or interruptions of the electricity or telecommunications
+networks, network paralysis following a virus attack, intervention by
+government authorities, natural disasters, water damage, earthquakes,
+fire, explosions, strikes and labor unrest, war, etc.
+
+11.2 Any failure by either Party, on one or more occasions, to invoke
+one or more of the provisions hereof, shall under no circumstances be
+interpreted as being a waiver by the interested Party of its right to
+invoke said provision(s) subsequently.
+
+11.3 The Agreement cancels and replaces any or all previous agreements,
+whether written or oral, between the Parties and having the same
+purpose, and constitutes the entirety of the agreement between said
+Parties concerning said purpose. No supplement or modification to the
+terms and conditions hereof shall be effective as between the Parties
+unless it is made in writing and signed by their duly authorized
+representatives.
+
+11.4 In the event that one or more of the provisions hereof were to
+conflict with a current or future applicable act or legislative text,
+said act or legislative text shall prevail, and the Parties shall make
+the necessary amendments so as to comply with said act or legislative
+text. All other provisions shall remain effective. Similarly, invalidity
+of a provision of the Agreement, for any reason whatsoever, shall not
+cause the Agreement as a whole to be invalid.
+
+
+      11.5 LANGUAGE
+
+The Agreement is drafted in both French and English and both versions
+are deemed authentic.
+
+
+    Article 12 - NEW VERSIONS OF THE AGREEMENT
+
+12.1 Any person is authorized to duplicate and distribute copies of this
+Agreement.
+
+12.2 So as to ensure coherence, the wording of this Agreement is
+protected and may only be modified by the authors of the License, who
+reserve the right to periodically publish updates or new versions of the
+Agreement, each with a separate number. These subsequent versions may
+address new issues encountered by Free Software.
+
+12.3 Any Software distributed under a given version of the Agreement may
+only be subsequently distributed under the same version of the Agreement
+or a subsequent version, subject to the provisions of Article 5.3.4
+<#compatibility>.
+
+
+    Article 13 - GOVERNING LAW AND JURISDICTION
+
+13.1 The Agreement is governed by French law. The Parties agree to
+endeavor to seek an amicable solution to any disagreements or disputes
+that may arise during the performance of the Agreement.
+
+13.2 Failing an amicable solution within two (2) months as from their
+occurrence, and unless emergency proceedings are necessary, the
+disagreements or disputes shall be referred to the Paris Courts having
+jurisdiction, by the more diligent Party.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,87 @@
+Univariate parametric and non-parametric hypothesis testing with correction for multiple testing  
+================================================================================================  
+
+A Galaxy module from the [Workflow4metabolomics](http://workflow4metabolomics.org) infrastructure    
+
+Status: [![Build Status](https://travis-ci.org/workflow4metabolomics/univariate.svg?branch=master)](https://travis-ci.org/workflow4metabolomics/univariate).
+
+### Description
+
+**Version:** 2.2.0   
+**Date:** 2016-10-30  
+**Author:** Marie Tremblay-Franco (INRA, MetaToul, MetaboHUB, W4M Core Development Team) and Etienne A. Thevenot (CEA, LIST, MetaboHUB, W4M Core Development Team)    
+**Email:** [marie.tremblay-franco(at)toulouse.inra.fr](mailto:marie.tremblay-franco@toulouse.inra.fr); [etienne.thevenot(at)cea.fr](mailto:etienne.thevenot@cea.fr)  
+**Citation:** Thevenot E.A., Roux A., Xu Y., Ezan E. and Junot C. (2015). Analysis of the human adult urinary metabolome variations with age, body mass index and gender by implementing a comprehensive workflow for univariate and OPLS statistical analyses. *Journal of Proteome Research*, **14**:3322-3335. [doi:10.1021/acs.jproteome.5b00354](http://dx.doi.org/10.1021/acs.jproteome.5b00354)  
+**Reference history:** [W4M00001a_sacurine-subset-statistics](http://galaxy.workflow4metabolomics.org/history/list_published), [W4M00004_mtbls1](http://galaxy.workflow4metabolomics.org/history/list_published)  
+**Licence:** CeCILL  
+**Funding:** Agence Nationale de la Recherche ([MetaboHUB](http://www.metabohub.fr/index.php?lang=en&Itemid=473) national infrastructure for metabolomics and fluxomics, ANR-11-INBS-0010 grant)
+
+### Installation
+
+ * Configuration file: `univariate_config.xml`  
+ * Image file: 
+  + `static/images/univariate_workflowPositionImage.png`   
+ * Wrapper file: `univariate_wrapper.R`  
+ * Script file: `univariate_script.R`  
+ * R packages  
+  + **batch** from CRAN  
+  
+    ```r
+    install.packages("batch", dep=TRUE)  
+    ```
+  + **PMCMR** from CRAN  
+  
+    ```r  
+    install.packages("PMCMR", dep=TRUE)  
+    ```    
+ 
+### Tests
+
+The code in the wrapper can be tested by running the `runit/univariate_runtests.R` R file
+
+You will need to install **RUnit** package in order to make it run:
+```r
+install.packages('RUnit', dependencies = TRUE)
+```
+
+### Working example  
+
+See the **W4M00001a_sacurine-subset-statistics**, **W4M00001b_sacurine-subset-complete**, **W4M00002_mtbls2**, **W4M00003_diaplasma** shared histories in the **Shared Data/Published Histories** menu (https://galaxy.workflow4metabolomics.org/history/list_published)  
+
+### News
+
+###### CHANGES IN VERSION 2.2.0  
+
+MAJOR MODIFICATION  
+
+ * ANOVA and Kruskal-Wallis: The p-values of the post-hoc tests (i.e. from pairwise comparisons) are now further corrected for multiple testing over all variables (previously, only the p-value of the -first- omnibus test was corrected over all variables)  
+
+MINOR MODIFICATION  
+
+ * All values in the 'dif', adjusted p-value, and 'sig' columns are now displayed (previously, the values were set to NA when the p-value of the omnibus test was not significant)  
+
+NEW FEATURE  
+
+ * Graphic: a single pdf file containing the graphics of all significant tests is now produced as '_figure.pdf' output: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The corrected p-value is indicated in the title of each plot  
+
+###### CHANGES IN VERSION 2.1.4
+
+NEW FEATURE  
+
+ * Level names are now separated by '.' instead of '-' previously in the column names of the output variableMetadata table (e.g., 'jour_ttest_J3.J10_fdr' instead of 'jour_ttest_J3-J10_fdr' previously)  
+
+INTERNAL MODIFICATION  
+
+ * Minor internal changes  
+
+###### CHANGES IN VERSION 2.1.2  
+
+INTERNAL MODIFICATION  
+
+ * Minor internal changes in .shed.yml for toolshed export
+
+###### CHANGES IN VERSION 2.1.1  
+
+INTERNAL MODIFICATION  
+
+ * Internal handling of 'NA' p-values (e.g. when intensities are identical in all samples).
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.xml	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,103 @@
+<project name="w4m.univariate" default="all">
+
+	<property name="tool.xml" value="univariate_config.xml"/>
+	<property name="conda.dir" value="${user.home}/w4m-conda"/>
+
+	<!--~~~
+	~ ALL ~
+	~~~~~-->
+
+	<target name="all"/>
+
+	<!--~~~~
+	~ TEST ~
+	~~~~~-->
+
+	<target name="test" depends="plain.test,planemo.lint,planemo.test"/>
+
+	<!--~~~~~~~~~~
+	~ PLAIN TEST ~
+	~~~~~~~~~~~-->
+
+	<target name="plain.test">
+		<exec executable="test/test-univ" failonerror="true"/>
+	</target>
+
+	<!--~~~~~~~~~~~~
+	~ PLANEMO LINT ~
+	~~~~~~~~~~~~~-->
+
+	<target name="planemo.lint">
+		<exec executable="planemo" failonerror="true">
+			<arg value="lint"/>
+			<arg value="${tool.xml}"/>
+		</exec>
+	</target>
+
+	<!--~~~~~~~~~~~~
+	~ PLANEMO TEST ~
+	~~~~~~~~~~~~~-->
+
+	<target name="planemo.test" depends="planemo.conda.install">
+		<exec executable="planemo" failonerror="true">
+			<arg value="test"/>
+			<arg value="--conda_prefix"/>
+			<arg value="${conda.dir}"/>
+			<arg value="--galaxy_branch"/>
+			<arg value="release_16.07"/>
+			<arg value="--conda_dependency_resolution"/>
+			<arg value="${tool.xml}"/>
+		</exec>
+	</target>
+
+	<!--~~~~~~~~~~~~~~~~~~~~~
+	~ PLANEMO CONDA INSTALL ~
+	~~~~~~~~~~~~~~~~~~~~~~-->
+
+	<target name="planemo.conda.install" depends="planemo.conda.init">
+		<exec executable="planemo" failonerror="true">
+			<arg value="conda_install"/>
+			<arg value="--conda_prefix"/>
+			<arg value="${conda.dir}"/>
+			<arg value="${tool.xml}"/>
+		</exec>
+	</target>
+
+	<!--~~~~~~~~~~~~~~~~~~
+	~ PLANEMO CONDA INIT ~
+	~~~~~~~~~~~~~~~~~~~-->
+
+	<target name="planemo.conda.init">
+		<exec executable="planemo" failonerror="true">
+			<arg value="conda_init"/>
+			<arg value="--conda_prefix"/>
+			<arg value="${conda.dir}"/>
+		</exec>
+	</target>
+
+	<!--~~~~~~~~~~~~~
+	~ PLANEMO SERVE ~
+	~~~~~~~~~~~~~~-->
+
+	<target name="planemo.serve" depends="planemo.conda.install">
+		<exec executable="planemo" failonerror="true">
+			<arg value="serve"/>
+			<arg value="--conda_prefix"/>
+			<arg value="${conda.dir}"/>
+			<arg value="--galaxy_branch"/>
+			<arg value="release_16.01"/>
+			<arg value="--conda_dependency_resolution"/>
+			<arg value="${tool.xml}"/>
+		</exec>
+	</target>
+
+
+	<!--~~~~~
+	~ CLEAN ~
+	~~~~~~-->
+
+	<target name="clean">
+		<delete dir="${conda.dir}"/>
+	</target>
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/example1/dataMatrix.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,4 @@
+dataMatrix	Ech10	Ech11	Ech12	Ech13	Ech14	Ech15
+MT1	3.439956551	3.399847335	3.335401704	3.4201777	3.24585851	3.401256321
+MT2	5.008458405	4.461291924	4.068043169	4.42768414	4.406640829	4.500370048
+MT3	3.99527636	4.051758488	4.332552332	4.348474118	4.253679544	4.26823853
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/example1/sampleMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+sampleMetadata	jour
+Ech10	J10
+Ech11	J10
+Ech12	J10
+Ech13	J3
+Ech14	J3
+Ech15	J3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/example1/variableMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,4 @@
+variableMetadata	PCA_XLOAD-h1	PCA_XLOAD-h2
+MT1	-0.048723936	0.05648187
+MT2	-0.067609139	0.084300327
+MT3	0.080335733	-0.0215397
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/input/dataMatrix.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+dataMatrix	s1	s2	s3	s4	s5	s6	s7	s8	s9	s10	s11	s12	s13	s14	s15	s16	s17	s18	s19	s20	s21	s22	s23	s24	s25	s26	s27	s28	s29	s30	s31	s32
+v1	7.416640524	6.9916690517	7.3404441347	7.0128372669	7.1702617447	6.820858055	7.2648178466	6.9561684785	7.2966652122	7.2695129676	7.2695129676	6.7986507145	6.9749720403	6.7788745443	7.0791812822	7.3617278549	7.4281348102	6.967548023	7.2304489469	6.6608655728	6.9614211415	6.8959747875	7.1398791179	7.2201081142	7.1673173643	6.6857418281	7.1789769761	6.7788745443	6.7291648707	6.7466342768	6.8954226013	6.9454686344
+v2	7.4563660483	6.9014583759	7.3873898441	6.9599948859	7.2095150414	6.7007038037	7.3159703664	6.8876173566	7.3010300174	7.2966652122	7.3138672415	6.7275413384	6.9863238219	6.7435098431	7.1038037552	7.3838153839	7.4409090978	6.7737865181	7.2174839705	6.48995862	6.8494194752	6.8344207673	7.1238516736	7.212187631	7.2041200098	6.6910815806	7.2900346336	6.7427252098	6.7185017719	6.6180482014	6.8512584099	6.9329808726
+v3	6.8785218529	6.7839036507	6.9025468337	7.0086002143	6.9314579215	6.8129134235	6.8305887328	7.0374265378	6.8767950339	6.8457180799	6.7888751864	6.9929951426	7.0374265378	6.8215135939	7.0718820441	6.809559782	6.8122447637	6.7795965634	6.8129134235	6.9599948859	6.8014037786	6.7355989795	6.8075350957	6.9929951426	6.7686381752	6.9339932144	6.7611758884	6.9740509489	6.9768083831	6.7058637978	6.9790929462	6.7032914641
+v4	7.1303338007	7.1398791179	7.0899051467	7.110589744	6.9947569885	6.9978231244	7.0374265378	7.1003705796	6.9698816903	6.8048207468	6.8543061025	6.6655810848	6.705008045	6.7275413384	6.7442930614	6.9498777528	7.1583625223	7.2013971516	7.1673173643	6.9169800999	7.1003705796	7.0453230179	7.0606978781	7.1003705796	7.0492180614	6.7693773999	6.7774268949	6.9211661027	6.8561245047	6.9656720182	7.0086002143	6.9758911823
+v5	7.0530784819	6.99122612	7.0569048894	6.9698816903	6.8603380665	6.8375885014	6.9633155586	7.0170333811	7.0681858989	6.9633155586	6.95375974	6.7481881046	6.7686381752	6.8175654357	6.8394781102	7.0492180614	7.1038037552	7.0681858989	7.0755469979	6.7259117139	6.9339932144	6.8948697121	6.9464523141	7.0043214168	6.9009131223	6.6875290504	6.7634280684	6.7209858267	6.6454223676	6.7923917595	6.7902852344	6.8312297579
+v6	6.9876663096	7.0969100478	7.1072100036	7.0569048894	7.0000000434	6.9973864281	7.0644580267	7.0863598663	7.0043214168	6.9772662582	6.9434945654	6.9680157607	6.9556877984	7.1553360678	6.9454686344	6.9309490821	7.0086002143	7.0334237957	7.0086002143	6.9206450535	7.0043214168	6.9749720403	6.9489018098	6.9400182049	6.8750613213	6.9434945654	6.9057959343	6.9614211415	6.9518230838	6.9415114823	6.9304396457	6.9304396457
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/input/sampleMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,33 @@
+sampleMetadata	quant	qual
+s1	56	A
+s2	24	A
+s3	35	A
+s4	32	A
+s5	54	A
+s6	53	A
+s7	30	A
+s8	20	A
+s9	41	B
+s10	34	B
+s11	44	B
+s12	43	B
+s13	52	B
+s14	46	B
+s15	51	B
+s16	36	B
+s17	31	C
+s18	25	C
+s19	40	C
+s20	50	C
+s21	22	C
+s22	29	C
+s23	49	C
+s24	19	C
+s25	55	D
+s26	39	D
+s27	45	D
+s28	26	D
+s29	23	D
+s30	42	D
+s31	33	D
+s32	21	D
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/input/variableMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+variableMetadata	sample_mean
+v1	12620948.56
+v2	12661823.42
+v3	7680621.526
+v4	9901182.687
+v5	8311866.237
+v6	9792909.819
Binary file runit/output/figure.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/output/information.txt	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,49 @@
+
+Start of the 'Univariate' Galaxy module call: Sat 03 Jun 2017 11:00:34 PM
+
+Performing 'kruskal'
+
+The following 3 variables (50%) were found significant at the 0.05 level:
+v4
+v5
+v6
+
+End of 'Univariate' Galaxy module call: 2017-06-03 23:00:34
+
+
+
+============================================================================
+Additional information about the call:
+
+1) Parameters:
+                     value                          
+dataMatrix_in        "./input/dataMatrix.tsv"       
+sampleMetadata_in    "./input/sampleMetadata.tsv"   
+variableMetadata_in  "./input/variableMetadata.tsv" 
+variableMetadata_out "./output/variableMetadata.tsv"
+figure               "./output/figure.pdf"          
+information          "./output/information.txt"     
+facC                 "qual"                         
+tesC                 "kruskal"                      
+adjC                 "fdr"                          
+thrN                 "0.05"                         
+
+2) Session Info:
+R version 3.3.1 (2016-06-21)
+Platform: x86_64-pc-linux-gnu (64-bit)
+Running under: Ubuntu 16.04.1 LTS
+
+locale:
+ [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
+ [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
+ [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
+ [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
+ [9] LC_ADDRESS=C               LC_TELEPHONE=C            
+[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
+
+attached base packages:
+[1] stats     graphics  grDevices utils     datasets  base     
+
+other attached packages:
+[1] PMCMR_4.1   batch_1.1-4
+============================================================================
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/output/variableMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+variableMetadata	sample_mean	qual_kruskal_fdr	qual_kruskal_sig	qual_kruskal_B.A_dif	qual_kruskal_C.A_dif	qual_kruskal_D.A_dif	qual_kruskal_C.B_dif	qual_kruskal_D.B_dif	qual_kruskal_D.C_dif	qual_kruskal_B.A_fdr	qual_kruskal_C.A_fdr	qual_kruskal_D.A_fdr	qual_kruskal_C.B_fdr	qual_kruskal_D.B_fdr	qual_kruskal_D.C_fdr	qual_kruskal_B.A_sig	qual_kruskal_C.A_sig	qual_kruskal_D.A_sig	qual_kruskal_C.B_sig	qual_kruskal_D.B_sig	qual_kruskal_D.C_sig
+v1	12620948.56	0.147579228303049	0	0.0827976191000008	-0.0378359353499995	-0.254400932999999	-0.12063355445	-0.3371985521	-0.21656499765	0.999945671392641	0.99999320349658	0.185342280966466	0.997174540126794	0.401201067449129	0.580170916884995	0	0	0	0	0	0
+v2	12661823.42	0.246364577097618	0	0.11547952005	-0.0981193892499999	-0.2877631538	-0.2135989093	-0.40324267385	-0.18964376455	0.999945671392641	0.99999320349658	0.291618067987092	0.997174540126794	0.401201067449129	0.890397531402986	0	0	0	0	0	0
+v3	7680621.526	0.293234285978368	0	-0.0292777863999998	-0.0806444136	-0.0392186484999995	-0.0513666272000002	-0.00994086209999967	0.0414257651000005	0.999945671392641	0.99999320349658	0.593281055056761	0.997174540126794	0.593281055056761	0.999155846185138	0	0	0	0	0	0
+v4	9901182.687	0.000819466212247517	1	-0.32058095905	0.00523271645000012	-0.1517188027	0.3258136755	0.16886215635	-0.15695151915	0.0133536911280914	0.99999320349658	0.185342280966466	0.00430289478770107	0.593281055056761	0.143731083414931	1	0	0	1	0	0
+v5	8311866.237	0.0115079177714078	1	-0.0839349800499996	-0.00516703969999988	-0.203697253750001	0.0787679403499997	-0.119762273700001	-0.198530214050001	0.999945671392641	0.99999320349658	0.0336157236420893	0.997174540126794	0.401201067449129	0.073221827596323	0	0	1	0	0	0
+v6	9792909.819	0.00429379409695042	1	-0.0988296785000005	-0.0710347295000009	-0.124705894050001	0.0277949489999996	-0.0258762155500003	-0.0536711645499999	0.535700151485478	0.99999320349658	0.00294595180681068	0.997174540126794	0.401201067449129	0.302648332248575	0	0	1	0	0	0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/univariate_runtests.R	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,103 @@
+#!/usr/bin/env Rscript
+
+## Package
+##--------
+
+library(RUnit)
+
+## Constants
+##----------
+
+testOutDirC <- "output"
+argVc <- commandArgs(trailingOnly = FALSE)
+scriptPathC <- sub("--file=", "", argVc[grep("--file=", argVc)])
+
+
+## Functions
+##-----------
+
+## Reading tables (matrix or data frame)
+readTableF <- function(fileC, typeC = c("matrix", "dataframe")[1]) {
+
+    	file.exists(fileC) || stop(paste0("No output file \"", fileC ,"\"."))
+
+        switch(typeC,
+               matrix = return(t(as.matrix(read.table(file = fileC,
+                   header = TRUE,
+                   row.names = 1,
+                   sep = "\t",
+                   stringsAsFactors = FALSE)))),
+               dataframe = return(read.table(file = fileC,
+                   header = TRUE,
+                   row.names = 1,
+                   sep = "\t",
+                   stringsAsFactors = FALSE)))
+
+}
+
+## Call wrapper
+wrapperCallF <- function(paramLs) {
+
+	## Set program path
+    	wrapperPathC <- file.path(dirname(scriptPathC), "..", "univariate_wrapper.R")
+
+	## Set arguments
+	argLs <- NULL
+	for (parC in names(paramLs))
+		argLs <- c(argLs, parC, paramLs[[parC]])
+
+	## Call
+	wrapperCallC <- paste(c(wrapperPathC, argLs), collapse = " ")
+
+        if(.Platform$OS.type == "windows")
+            wrapperCallC <- paste("Rscript", wrapperCallC)
+
+	wrapperCodeN <- system(wrapperCallC)
+
+	if (wrapperCodeN != 0)
+		stop("Error when running univariate_wrapper.R.")
+
+	## Get output
+	outLs <- list()
+	if ("dataMatrix_out" %in% names(paramLs))
+            outLs[["datMN"]] <- readTableF(paramLs[["dataMatrix_out"]], "matrix")
+	if ("sampleMetadata_out" %in% names(paramLs))
+            outLs[["samDF"]] <- readTableF(paramLs[["sampleMetadata_out"]], "dataframe")
+	if ("variableMetadata_out" %in% names(paramLs))
+            outLs[["varDF"]] <- readTableF(paramLs[["variableMetadata_out"]], "dataframe")
+        if("information" %in% names(paramLs))
+            outLs[["infVc"]] <- readLines(paramLs[["information"]])
+
+	return(outLs)
+}
+
+## Setting default parameters
+defaultArgF <- function(testInDirC) {
+
+    defaultArgLs <- list()
+    if(file.exists(file.path(dirname(scriptPathC), testInDirC, "dataMatrix.tsv")))
+        defaultArgLs[["dataMatrix_in"]] <- file.path(dirname(scriptPathC), testInDirC, "dataMatrix.tsv")
+    if(file.exists(file.path(dirname(scriptPathC), testInDirC, "sampleMetadata.tsv")))
+        defaultArgLs[["sampleMetadata_in"]] <- file.path(dirname(scriptPathC), testInDirC, "sampleMetadata.tsv")
+    if(file.exists(file.path(dirname(scriptPathC), testInDirC, "variableMetadata.tsv")))
+        defaultArgLs[["variableMetadata_in"]] <- file.path(dirname(scriptPathC), testInDirC, "variableMetadata.tsv")
+
+    defaultArgLs[["variableMetadata_out"]] <- file.path(dirname(scriptPathC), testOutDirC, "variableMetadata.tsv")
+    defaultArgLs[["figure"]] <- file.path(dirname(scriptPathC), testOutDirC, "figure.pdf")
+    defaultArgLs[["information"]] <- file.path(dirname(scriptPathC), testOutDirC, "information.txt")
+
+    defaultArgLs
+
+}
+
+## Main
+##-----
+
+## Create output folder
+file.exists(testOutDirC) || dir.create(testOutDirC)
+
+## Run tests
+test.suite <- defineTestSuite('tests', dirname(scriptPathC), testFileRegexp = paste0('^.*_tests\\.R$'), testFuncRegexp = '^.*$')
+isValidTestSuite(test.suite)
+test.results <- runTestSuite(test.suite)
+print(test.results)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/univariate_tests.R	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,63 @@
+test_input_anova <- function() {
+
+    testDirC <- "input"
+    argLs <- list(facC = "qual",
+                  tesC = "anova",
+                  adjC = "fdr",
+                  thrN = "0.05")
+
+    argLs <- c(defaultArgF(testDirC), argLs)
+    outLs <- wrapperCallF(argLs)
+
+    checkEqualsNumeric(outLs[["varDF"]]["v6", "qual_anova_fdr"], 1.924156e-03, tolerance = 1e-6)
+
+    checkEqualsNumeric(outLs[["varDF"]]["v4", "qual_anova_D.C_fdr"], 0.01102016, tolerance = 1e-6)
+
+}
+
+test_input_kruskal <- function() {
+
+    testDirC <- "input"
+    argLs <- list(facC = "qual",
+                  tesC = "kruskal",
+                  adjC = "fdr",
+                  thrN = "0.05")
+
+    argLs <- c(defaultArgF(testDirC), argLs)
+    outLs <- wrapperCallF(argLs)
+
+    checkEqualsNumeric(outLs[["varDF"]]["v4", "qual_kruskal_fdr"], 0.0008194662, tolerance = 1e-7)
+
+    checkEqualsNumeric(outLs[["varDF"]]["v6", "qual_kruskal_D.A_fdr"], 0.002945952, tolerance = 1e-7)
+
+}
+
+test_example1_wilcoxDif <- function() {
+
+    testDirC <- "example1"
+    argLs <- list(facC = "jour",
+                  tesC = "wilcoxon",
+                  adjC = "fdr",
+                  thrN = "0.05")
+
+    argLs <- c(defaultArgF(testDirC), argLs)
+    outLs <- wrapperCallF(argLs)
+    
+    checkEqualsNumeric(outLs[["varDF"]]["MT3", "jour_wilcoxon_J3.J10_dif"], 0.216480042, tolerance = 1e-8)
+
+}
+
+test_example1_ttestFdr <- function() {
+
+    testDirC <- "example1"
+    argLs <- list(facC = "jour",
+                  tesC = "ttest",
+                  adjC = "fdr",
+                  thrN = "0.05")
+
+    argLs <- c(defaultArgF(testDirC), argLs)
+    outLs <- wrapperCallF(argLs)
+
+    checkEqualsNumeric(outLs[["varDF"]]["MT3", "jour_ttest_J3.J10_fdr"], 0.7605966, tolerance = 1e-6)
+
+}
Binary file static/images/univariate_workflowPositionImage.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/dataMatrix.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+dataMatrix	s1	s2	s3	s4	s5	s6	s7	s8	s9	s10	s11	s12	s13	s14	s15	s16	s17	s18	s19	s20	s21	s22	s23	s24	s25	s26	s27	s28	s29	s30	s31	s32
+v1	7.416640524	6.9916690517	7.3404441347	7.0128372669	7.1702617447	6.820858055	7.2648178466	6.9561684785	7.2966652122	7.2695129676	7.2695129676	6.7986507145	6.9749720403	6.7788745443	7.0791812822	7.3617278549	7.4281348102	6.967548023	7.2304489469	6.6608655728	6.9614211415	6.8959747875	7.1398791179	7.2201081142	7.1673173643	6.6857418281	7.1789769761	6.7788745443	6.7291648707	6.7466342768	6.8954226013	6.9454686344
+v2	7.4563660483	6.9014583759	7.3873898441	6.9599948859	7.2095150414	6.7007038037	7.3159703664	6.8876173566	7.3010300174	7.2966652122	7.3138672415	6.7275413384	6.9863238219	6.7435098431	7.1038037552	7.3838153839	7.4409090978	6.7737865181	7.2174839705	6.48995862	6.8494194752	6.8344207673	7.1238516736	7.212187631	7.2041200098	6.6910815806	7.2900346336	6.7427252098	6.7185017719	6.6180482014	6.8512584099	6.9329808726
+v3	6.8785218529	6.7839036507	6.9025468337	7.0086002143	6.9314579215	6.8129134235	6.8305887328	7.0374265378	6.8767950339	6.8457180799	6.7888751864	6.9929951426	7.0374265378	6.8215135939	7.0718820441	6.809559782	6.8122447637	6.7795965634	6.8129134235	6.9599948859	6.8014037786	6.7355989795	6.8075350957	6.9929951426	6.7686381752	6.9339932144	6.7611758884	6.9740509489	6.9768083831	6.7058637978	6.9790929462	6.7032914641
+v4	7.1303338007	7.1398791179	7.0899051467	7.110589744	6.9947569885	6.9978231244	7.0374265378	7.1003705796	6.9698816903	6.8048207468	6.8543061025	6.6655810848	6.705008045	6.7275413384	6.7442930614	6.9498777528	7.1583625223	7.2013971516	7.1673173643	6.9169800999	7.1003705796	7.0453230179	7.0606978781	7.1003705796	7.0492180614	6.7693773999	6.7774268949	6.9211661027	6.8561245047	6.9656720182	7.0086002143	6.9758911823
+v5	7.0530784819	6.99122612	7.0569048894	6.9698816903	6.8603380665	6.8375885014	6.9633155586	7.0170333811	7.0681858989	6.9633155586	6.95375974	6.7481881046	6.7686381752	6.8175654357	6.8394781102	7.0492180614	7.1038037552	7.0681858989	7.0755469979	6.7259117139	6.9339932144	6.8948697121	6.9464523141	7.0043214168	6.9009131223	6.6875290504	6.7634280684	6.7209858267	6.6454223676	6.7923917595	6.7902852344	6.8312297579
+v6	6.9876663096	7.0969100478	7.1072100036	7.0569048894	7.0000000434	6.9973864281	7.0644580267	7.0863598663	7.0043214168	6.9772662582	6.9434945654	6.9680157607	6.9556877984	7.1553360678	6.9454686344	6.9309490821	7.0086002143	7.0334237957	7.0086002143	6.9206450535	7.0043214168	6.9749720403	6.9489018098	6.9400182049	6.8750613213	6.9434945654	6.9057959343	6.9614211415	6.9518230838	6.9415114823	6.9304396457	6.9304396457
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output-variableMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+variableMetadata	sample_mean	qual_kruskal_fdr	qual_kruskal_sig	qual_kruskal_B.A_dif	qual_kruskal_C.A_dif	qual_kruskal_D.A_dif	qual_kruskal_C.B_dif	qual_kruskal_D.B_dif	qual_kruskal_D.C_dif	qual_kruskal_B.A_fdr	qual_kruskal_C.A_fdr	qual_kruskal_D.A_fdr	qual_kruskal_C.B_fdr	qual_kruskal_D.B_fdr	qual_kruskal_D.C_fdr	qual_kruskal_B.A_sig	qual_kruskal_C.A_sig	qual_kruskal_D.A_sig	qual_kruskal_C.B_sig	qual_kruskal_D.B_sig	qual_kruskal_D.C_sig
+v1	12620948.56	0.147579228303049	0	0.0827976191000008	-0.0378359353499995	-0.254400932999999	-0.12063355445	-0.3371985521	-0.21656499765	0.999945671392641	0.99999320349658	0.185342280966466	0.997174540126794	0.401201067449129	0.580170916884995	0	0	0	0	0	0
+v2	12661823.42	0.246364577097618	0	0.11547952005	-0.0981193892499999	-0.2877631538	-0.2135989093	-0.40324267385	-0.18964376455	0.999945671392641	0.99999320349658	0.291618067987092	0.997174540126794	0.401201067449129	0.890397531402986	0	0	0	0	0	0
+v3	7680621.526	0.293234285978368	0	-0.0292777863999998	-0.0806444136	-0.0392186484999995	-0.0513666272000002	-0.00994086209999967	0.0414257651000005	0.999945671392641	0.99999320349658	0.593281055056761	0.997174540126794	0.593281055056761	0.999155846185138	0	0	0	0	0	0
+v4	9901182.687	0.000819466212247517	1	-0.32058095905	0.00523271645000012	-0.1517188027	0.3258136755	0.16886215635	-0.15695151915	0.0133536911280914	0.99999320349658	0.185342280966466	0.00430289478770107	0.593281055056761	0.143731083414931	1	0	0	1	0	0
+v5	8311866.237	0.0115079177714078	1	-0.0839349800499996	-0.00516703969999988	-0.203697253750001	0.0787679403499997	-0.119762273700001	-0.198530214050001	0.999945671392641	0.99999320349658	0.0336157236420893	0.997174540126794	0.401201067449129	0.073221827596323	0	0	1	0	0	0
+v6	9792909.819	0.00429379409695042	1	-0.0988296785000005	-0.0710347295000009	-0.124705894050001	0.0277949489999996	-0.0258762155500003	-0.0536711645499999	0.535700151485478	0.99999320349658	0.00294595180681068	0.997174540126794	0.401201067449129	0.302648332248575	0	0	1	0	0	0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sampleMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,33 @@
+sampleMetadata	quant	qual
+s1	56	A
+s2	24	A
+s3	35	A
+s4	32	A
+s5	54	A
+s6	53	A
+s7	30	A
+s8	20	A
+s9	41	B
+s10	34	B
+s11	44	B
+s12	43	B
+s13	52	B
+s14	46	B
+s15	51	B
+s16	36	B
+s17	31	C
+s18	25	C
+s19	40	C
+s20	50	C
+s21	22	C
+s22	29	C
+s23	49	C
+s24	19	C
+s25	55	D
+s26	39	D
+s27	45	D
+s28	26	D
+s29	23	D
+s30	42	D
+s31	33	D
+s32	21	D
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/variableMetadata.tsv	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,7 @@
+variableMetadata	sample_mean
+v1	12620948.56
+v2	12661823.42
+v3	7680621.526
+v4	9901182.687
+v5	8311866.237
+v6	9792909.819
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/.gitignore	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,1 @@
+*.tsv
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/test-univ	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Constants {{{1
+################################################################
+
+PROG_PATH=$(dirname $0)
+
+# MAIN {{{1
+################################################################
+
+$PROG_PATH/../univariate_wrapper.R dataMatrix_in $PROG_PATH/../test-data/dataMatrix.tsv sampleMetadata_in $PROG_PATH/../test-data/sampleMetadata.tsv variableMetadata_in $PROG_PATH/../test-data/variableMetadata.tsv facC qual tesC kruskal adjC fdr thrN 0.05 variableMetadata_out $PROG_PATH/outputVariableMetadata.tsv
+
+if ! diff "$PROG_PATH/outputVariableMetadata.tsv" "$PROG_PATH/../test-data/output-variableMetadata.tsv" ; then
+	echo "Incorrect output variable metadata." >&2
+	exit 1
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/univariate_config.xml	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,297 @@
+<tool id="Univariate" name="Univariate" version="2.2.3">
+  <description>Univariate statistics</description>
+  
+  <requirements>
+    <requirement type="package">r-batch</requirement>
+    <requirement type="package">r-PMCMR</requirement>
+  </requirements>
+
+  <stdio>
+    <exit_code range="1:" level="fatal" />
+  </stdio>
+  
+  <command><![CDATA[
+  Rscript $__tool_directory__/univariate_wrapper.R
+
+  dataMatrix_in "$dataMatrix_in"
+  sampleMetadata_in "$sampleMetadata_in"
+  variableMetadata_in "$variableMetadata_in"
+  
+  facC "$facC"
+  tesC "$tesC"
+  adjC "$adjC"
+  thrN "$thrN"	  
+  
+  variableMetadata_out "$variableMetadata_out"
+  figure "$figure"
+  information "$information"
+  ]]></command>
+  <inputs>
+    <param name="dataMatrix_in" label="Data matrix file" type="data" format="tabular" help="variable x sample, decimal: '.', missing: NA, mode: numerical, sep: tabular" />
+    <param name="sampleMetadata_in" label="Sample metadata file" type="data" format="tabular" help="sample x metadata, decimal: '.', missing: NA, mode: character and numerical, sep: tabular" />
+    <param name="variableMetadata_in" label="Variable metadata file" type="data" format="tabular" help="variable x metadata, decimal: '.', missing: NA, mode: character and numerical, sep: tabular"  />
+    <param name="facC" label="Factor of interest" type="text" help="Name of the column of the sample metadata table corresponding to the qualitative or quantitative variable"/>
+    <param name="tesC" label="Test" type="select" help="">
+      <option value="ttest">ttest (qualitative, 2 levels)</option>
+      <option value="wilcoxon">Wilcoxon test (qualitative, 2 levels)</option>      
+      <option value="anova">Analysis of variance (qualitative, more than 2 levels)</option>
+      <option value="kruskal">Kruskal-Wallis rank test (qualitative, more than 2 levels)</option>
+      <option value="pearson">Pearson correlation test (quantitative)</option>
+      <option value="spearman">Spearman correlation rank test (quantitative)</option>
+    </param>
+    <param name="adjC" label="Method for multiple testing correction" type="select" help="">
+      <option value="fdr">fdr</option>
+      <option value="BH">BH</option>
+      <option value="bonferroni">bonferroni</option>
+      <option value="BY">BY</option>
+      <option value="hochberg">hochberg</option>
+      <option value="holm">holm</option>
+      <option value="hommel">hommel</option>
+      <option value="none">none</option>
+    </param>
+    <param name="thrN" type="float" value="0.05" label="(Corrected) p-value significance threshold" help="Must be between 0 and 1"/>
+  </inputs>
+  
+  <outputs>
+    <data name="variableMetadata_out" label="${tool.name}_${variableMetadata_in.name}" format="tabular" ></data>
+    <data name="figure" label="${tool.name}_figure.pdf" format="pdf"/>
+    <data name="information" label="${tool.name}_information.txt" format="txt"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="dataMatrix_in" value="dataMatrix.tsv"/>
+      <param name="sampleMetadata_in" value="sampleMetadata.tsv"/>
+      <param name="variableMetadata_in" value="variableMetadata.tsv"/>
+      <param name="facC" value="qual"/>
+      <param name="tesC" value="kruskal"/>
+      <param name="adjC" value="fdr"/>
+      <param name="thrN" value="0.05"/>
+      <output name="variableMetadata_out" file="output-variableMetadata.tsv"/>
+    </test>
+  </tests>
+  
+  <help>
+    
+.. class:: infomark
+
+| **Tool update: See the 'NEWS' section at the bottom of the page**
+
+---------------------------------------------------
+
+.. class:: infomark
+
+**Authors**
+
+| **Marie Tremblay-Franco (marie.tremblay-franco@toulouse.inra.fr)** and **Etienne Thevenot (etienne.thevenot@cea.fr)** wrote this wrapper of R univariate statistical tests.
+| MetaboHUB: The French National Infrastructure for Metabolomics and Fluxomics (http://www.metabohub.fr/en)
+
+---------------------------------------------------
+
+.. class:: infomark
+
+**Please cite**
+
+R Core Team (2013). R: A language and Environment for Statistical Computing. http://www.r-project.org
+
+---------------------------------------------------
+
+.. class:: infomark
+
+**References**
+
+| Benjamini Y. and Hochberg Y. (1995). Controlling the false discovery rate: a practical and powerful approach for multiple testing. Journal of the Royal Statistical Society. Series B (Methodological), 57:289-300.
+| Dalgaard P. (2002). Introductory statistics with R. Springer.
+| Kvam P. and Vidakovic B. (2007). Nonparametric statistics with applications to science and engineering. Wiley.
+| Van Belle G., Fisher L., Heagerty P. and Lumley T. (2004). Biostatistics - a methodology for the health sciences. Wiley.
+| Pohlert T. (2015). PMCMR: Calculate pairwise multiple comparisons of mean rank sums. R package on CRAN.
+
+---------------------------------------------------
+
+=====================
+Univariate statistics
+=====================
+
+-----------
+Description
+-----------
+
+| The module performs two sample tests (t-test and Wilcoxon rank test), analysis of variance and Kruskal-Wallis rank test, and correlation tests (by using either the pearson or the spearman correlation)
+
+-----------------
+Workflow position
+-----------------
+
+.. image:: univariate_workflowPositionImage.png
+        :width: 584
+
+-----------
+Input files
+-----------
+
++------------------------------+------------+
+| File                         |   Format   |
++==============================+============+
+| 1)  Data matrix              |   tabular  |
++------------------------------+------------+
+| 2)  Sample metadata          |   tabular  |
++------------------------------+------------+
+| 3)  Variable metadata        |   tabular  |
++------------------------------+------------+
+
+----------
+Parameters
+----------
+	  
+Data matrix file
+	| variable x sample **dataMatrix** tabular separated file of the numeric data matrix, with . as decimal, and NA for missing values; the table must not contain metadata apart from row and column names; the row and column names must be identical to the rownames of the sample and variable metadata, respectively (see below)
+	|
+
+Sample metadata file
+	| sample x metadata **sampleMetadata** tabular separated file of the numeric and/or character sample metadata, with . as decimal and NA for missing values
+	|
+	
+Variable metadata file
+	| variable x metadata **variableMetadata** tabular separated file of the numeric and/or character variable metadata, with . as decimal and NA for missing values
+	|
+
+Factor
+	| Column of the sample metadata table to be used as qualitative factor (t-test, Wilcoxon test, Analysis of variance, Kruskal-Wallis test) or quantitative variable (correlation)
+	|
+
+Test
+	| Depending on the factor of interest (qualitative with 2 or more levels, or quantitative), and on the normality of the sample values (determining whether a parametric or nonparametric test is required), you can choose one of the 6 tests available:
+
+
++---------------------------+------------------+----------------------+----------------------+
+| Factor to be tested       | Number of levels |    Parametric test   |  Nonparametric test  |
++===========================+==================+======================+======================+
+| Qualitative               |         2        |       t-test         |    Wilcoxon test     |
++                           +------------------+----------------------+----------------------+
+|                           |        > 2       | Analysis of variance |    Kruskal-Wallis    |
++---------------------------+------------------+----------------------+----------------------+
+| Quantitative              |                  | Pearson correlation  | Spearman correlation |
++---------------------------+------------------+----------------------+----------------------+
+
+Method for multiple testing correction
+	| The 7 methods implemented in the 'p.adjust' R function are available and documented as follows:
+	| "The adjustment methods include the Bonferroni correction ("bonferroni") in which the p-values are multiplied by the number of comparisons. Less conservative corrections are also included by Holm (1979) ("holm"), Hochberg (1988) ("hochberg"), Hommel (1988) ("hommel"), Benjamini and Hochberg (1995) ("BH" or its alias "fdr"), and Benjamini and Yekutieli (2001) ("BY"), respectively. A pass-through option ("none") is also included. The set of methods are contained in the p.adjust.methods vector for the benefit of methods that need to have the method as an option and pass it on to p.adjust. The first four methods are designed to give strong control of the family-wise error rate. There seems no reason to use the unmodified Bonferroni correction because it is dominated by Holm's method, which is also valid under arbitrary assumptions. Hochberg's and Hommel's methods are valid when the hypothesis tests are independent or when they are non-negatively associated (Sarkar, 1998; Sarkar and Chang, 1997). Hommel's method is more powerful than Hochberg's, but the difference is usually small and the Hochberg p-values are faster to compute. The "BH" (aka "fdr") and "BY" method of Benjamini, Hochberg, and Yekutieli control the false discovery rate, the expected proportion of false discoveries amongst the rejected hypotheses. The false discovery rate is a less stringent condition than the family-wise error rate, so these methods are more powerful than the others."
+	|
+
+(Corrected) p-value significance threshold
+	|
+	|
+
+
+------------
+Output files
+------------
+	
+variableMetadata_out.tabular
+	| **variableMetadata** file identical to the file given as argument, except that (at least) three columns have been added:
+	| 1) [factor]_[test]_[class'a'].[class'b']_dif or [factor]_[test]_cor: difference of the means (ttest) or the medians (wilcoxon) between the two classes, or 'pearson' or 'spearman' correlations
+	| 2) [factor]_[test]_[class'a'].[class'b']_[method] or [factor]_[test]_[method]: adjusted p-values
+	| 3) [factor]_[test]_[class'a'].[class'b']_sig or [factor]_[test]_sig: significance (coded as '1' if below the threshold and '0' otherwise)
+	| In the case of 'anova' and 'kruskal', the columns 2) and 3) appear first to give the results from the ANOVA or Kruskal Wallis test, and then the results of the pairwise comparisons are reported in additional columns (otherwise NA in these columns): in the case of ANOVA, the Tukey HSD post-hoc analysis is used (for each comparison, the difference between means, p value, and significance are provided); in the case of Kruskal Wallis, the Nemenyi is performed (PMCMR package) (for each pairwise comparison, the difference between medians, p value and significance are provided); note that since version 2.2.0, the p-values of the post-hoc pairwise comparisons (ANOVA or Kruskal) are further corrected for multiple testing over all variables (as the p-value of the omnibus test in column 2)
+	|
+	
+figure.pdf
+	| File containing the graphics of all significant tests: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The variable name and the corrected p-value is indicated in the title of each plot
+	|
+
+information.txt
+	| File with all messages and warnings generated during the computation
+	|
+
+---------------------------------------------------
+
+---------------
+Working example
+---------------
+
+.. class:: infomark
+
+See the **W4M00001a_sacurine-subset-statistics**, **W4M00001b_sacurine-subset-complete**, **W4M00002_mtbls2**, **W4M00003_diaplasma** shared histories in the **Shared Data/Published Histories** menu (https://galaxy.workflow4metabolomics.org/history/list_published)
+
+---------------------------------------------------
+
+----
+NEWS
+----
+
+CHANGES IN VERSION 2.2.0
+========================
+
+MAJOR MODIFICATION
+
+ANOVA and Kruskal-Wallis: The p-values of the post-hoc tests (i.e. from pairwise comparisons) are now further corrected for multiple testing over all variables (previously, only the p-value of the omnibus test was corrected over all variables)
+
+MINOR MODIFICATION
+
+All values in the 'dif', adjusted p-value, and 'sig' columns are now displayed (previously, the values were set to NA when the p-value of the omnibus test was not significant)
+
+NEW FEATURE
+
+Graphic: a single pdf file containing the graphics of all significant tests is now produced as '_figure.pdf' output: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The corrected p-value is indicated in the title of each plot
+
+
+CHANGES IN VERSION 2.1.4
+========================
+
+NEW FEATURE
+
+Level names are now separated by '.' instead of '-' previously in the column names of the output variableMetadata table (e.g., 'jour_ttest_J3.J10_fdr' instead of 'jour_ttest_J3-J10_fdr' previously)
+
+INTERNAL MODIFICATIONS
+
+Minor internal changes for toolshed export
+
+CHANGES IN VERSION 2.1.2
+========================
+
+INTERNAL MODIFICATIONS
+
+Minor internal changes for toolshed export
+
+CHANGES IN VERSION 2.1.1
+========================
+
+INTERNAL MODIFICATIONS
+
+Internal handling of 'NA' p-values (e.g. when intensities are identical in all samples)
+
+CHANGES IN VERSION 2.0.1
+========================
+
+NEW FEATURE
+
+(corrected) p-value threshold can be set to any value between 0 and 1
+    
+  </help>
+  
+  <citations>
+    <citation type="bibtex">@Manual{,
+    title = {R: A Language and Environment for Statistical Computing},
+    author = {{R Core Team}},
+    organization = {R Foundation for Statistical Computing},
+    address = {Vienna, Austria},
+    year = {2016},
+    url = {https://www.R-project.org/},
+    }</citation>
+    <citation type="bibtex">@Article{Thevenot2015,
+    Title                    = {Analysis of the human adult urinary metabolome variations with age, body mass index and gender by implementing a comprehensive workflow for univariate and OPLS statistical analyses},
+    Author                   = {Thevenot, Etienne A. and Roux, Aurelie and Xu, Ying and Ezan, Eric and Junot, Christophe},
+    Journal                  = {Journal of Proteome Research},
+    Year                     = {2015},
+    Note                     = {PMID: 26088811},
+    Number                   = {8},
+    Pages                    = {3322-3335},
+    Volume                   = {14},
+    
+    Doi                      = {10.1021/acs.jproteome.5b00354},
+    Url                      = {http://pubs.acs.org/doi/full/10.1021/acs.jproteome.5b00354}
+    }</citation>
+    <citation type="doi">10.1093/bioinformatics/btu813</citation>
+  </citations>
+  
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/univariate_script.R	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,332 @@
+univariateF <- function(datMN,
+                        samDF,
+                        varDF,
+                        facC,
+                        tesC = c("ttest", "wilcoxon", "anova", "kruskal", "pearson", "spearman")[1],
+                        adjC = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none")[7],
+                        thrN = 0.05,
+                        pdfC) {
+
+
+    ## Option
+
+    strAsFacL <- options()$stringsAsFactors
+    options(stingsAsFactors = FALSE)
+    options(warn = -1)
+
+    ## Getting the response (either a factor or a numeric)
+
+    if(mode(samDF[, facC]) == "character") {
+        facFcVn <- factor(samDF[, facC])
+        facLevVc <- levels(facFcVn)
+    } else
+        facFcVn <- samDF[, facC]
+
+    cat("\nPerforming '", tesC, "'\n", sep="")
+
+    varPfxC <- paste0(make.names(facC), "_", tesC, "_")
+
+    
+    if(tesC %in% c("ttest", "wilcoxon", "pearson", "spearman")) {
+
+        
+        switch(tesC,
+               ttest = {
+                   staF <- function(y) diff(tapply(y, facFcVn, function(x) mean(x, na.rm = TRUE)))
+                   tesF <- function(y) t.test(y ~ facFcVn)[["p.value"]]
+               },
+               wilcoxon = {
+                   staF <- function(y) diff(tapply(y, facFcVn, function(x) median(x, na.rm = TRUE)))
+                   tesF <- function(y) wilcox.test(y ~ facFcVn)[["p.value"]]
+               },
+               pearson = {
+                   staF <- function(y) cor(facFcVn, y, method = "pearson", use = "pairwise.complete.obs")
+                   tesF <- function(y) cor.test(facFcVn, y, method = "pearson", use = "pairwise.complete.obs")[["p.value"]]
+               },
+               spearman = {
+                   staF <- function(y) cor(facFcVn, y, method = "spearman", use = "pairwise.complete.obs")
+                   tesF <- function(y) cor.test(facFcVn, y, method = "spearman", use = "pairwise.complete.obs")[["p.value"]]
+               })
+
+        staVn <- apply(datMN, 2, staF)
+
+        adjVn <- p.adjust(apply(datMN,
+                                2,
+                                tesF),
+                          method = adjC)
+
+        sigVn <- as.numeric(adjVn < thrN)
+
+        if(tesC %in% c("ttest", "wilcoxon"))
+            varPfxC <- paste0(varPfxC, paste(rev(facLevVc), collapse = "."), "_")
+
+        varDF[, paste0(varPfxC, ifelse(tesC %in% c("ttest", "wilcoxon"), "dif", "cor"))] <- staVn
+
+        varDF[, paste0(varPfxC, adjC)] <- adjVn
+
+        varDF[, paste0(varPfxC, "sig")] <- sigVn
+
+        ## graphic
+
+        pdf(pdfC, onefile = TRUE)
+
+        varVi <- which(sigVn > 0)
+
+        if(tesC %in% c("ttest", "wilcoxon")) {
+
+            facVc <- as.character(facFcVn)
+            names(facVc) <- rownames(samDF)
+
+            for(varI in varVi) {
+                
+                varC <- rownames(varDF)[varI]
+                
+                boxF(facFcVn,
+                     datMN[, varI],
+                     paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")"),
+                     facVc)
+                
+            }
+
+        } else { ## pearson or spearman
+
+            for(varI in varVi) {
+
+                varC <- rownames(varDF)[varI]
+
+                mod <- lm(datMN[, varI] ~  facFcVn)
+
+                plot(facFcVn, datMN[, varI],
+                     xlab = facC,
+                     ylab = "",
+                     pch = 18,
+                     main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ", R2 = ", signif(summary(mod)$r.squared, 2), ")"))
+            
+                abline(mod, col = "red")
+
+                }
+
+        }
+
+        dev.off()
+
+        
+    } else if(tesC == "anova") {
+
+        
+        ## getting the names of the pairwise comparisons 'class1Vclass2'
+        prwVc <- rownames(TukeyHSD(aov(datMN[, 1] ~ facFcVn))[["facFcVn"]])
+
+        prwVc <- gsub("-", ".", prwVc, fixed = TRUE) ## 2016-08-05: '-' character in dataframe column names seems not to be converted to "." by write.table on ubuntu R-3.3.1
+
+        ## omnibus and post-hoc tests
+        
+        aovMN <- t(apply(datMN, 2, function(varVn) {
+
+            aovMod <- aov(varVn ~ facFcVn)
+            pvaN <- summary(aovMod)[[1]][1, "Pr(>F)"]
+            hsdMN <- TukeyHSD(aovMod)[["facFcVn"]]
+            c(pvaN, c(hsdMN[, c("diff", "p adj")]))
+
+        }))
+
+        difVi <- 1:length(prwVc) + 1
+
+        ## difference of the means for each pairwise comparison
+        
+        difMN <- aovMN[, difVi]
+        colnames(difMN) <- paste0(varPfxC, prwVc, "_dif")
+
+        ## correction for multiple testing
+        
+        aovMN <- aovMN[, -difVi, drop = FALSE]
+        aovMN <- apply(aovMN, 2, function(pvaVn) p.adjust(pvaVn, method = adjC))
+
+        ## significance coding (0 = not significant, 1 = significant)
+        
+        adjVn <- aovMN[, 1]
+        sigVn <-  as.numeric(adjVn < thrN)
+
+        aovMN <- aovMN[, -1, drop = FALSE]
+        colnames(aovMN) <- paste0(varPfxC, prwVc, "_", adjC)
+
+        aovSigMN <- aovMN < thrN
+        mode(aovSigMN) <- "numeric"
+        colnames(aovSigMN) <- paste0(varPfxC, prwVc, "_sig")
+
+        ## final aggregated table
+
+        resMN <- cbind(adjVn, sigVn, difMN, aovMN, aovSigMN)
+        colnames(resMN)[1:2] <- paste0(varPfxC, c(adjC, "sig"))
+
+        varDF <- cbind.data.frame(varDF, as.data.frame(resMN))
+
+        ## graphic
+
+        pdf(pdfC, onefile = TRUE)
+        
+        for(varI in 1:nrow(varDF)) {
+            
+            if(sum(aovSigMN[varI, ]) > 0) {
+                
+                varC <- rownames(varDF)[varI]
+
+                boxplot(datMN[, varI] ~ facFcVn,
+                        main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")"))
+                
+                for(prwI in 1:length(prwVc)) {
+                    
+                    if(aovSigMN[varI, paste0(varPfxC, prwVc[prwI], "_sig")] == 1) {
+                        
+                        claVc <- unlist(strsplit(prwVc[prwI], ".", fixed = TRUE))
+                        aovClaVl <- facFcVn %in% claVc
+                        aovFc <- facFcVn[aovClaVl, drop = TRUE]
+                        aovVc <- as.character(aovFc)
+                        names(aovVc) <- rownames(samDF)[aovClaVl]
+                        boxF(aovFc,
+                             datMN[aovClaVl, varI],
+                             paste0(varC, " (", adjC, " = ", signif(aovMN[varI, paste0(varPfxC, prwVc[prwI], "_", adjC)], 2), ")"),
+                             aovVc)
+                        
+                    }
+                       
+                }
+                
+            }
+            
+        }
+
+        dev.off()
+
+        
+    } else if(tesC == "kruskal") {
+        
+
+        ## getting the names of the pairwise comparisons 'class1.class2'
+        
+        nemMN <- posthoc.kruskal.nemenyi.test(datMN[, 1], facFcVn, "Tukey")[["p.value"]]
+        nemVl <- c(lower.tri(nemMN, diag = TRUE))
+        nemClaMC <- cbind(rownames(nemMN)[c(row(nemMN))][nemVl],
+                          colnames(nemMN)[c(col(nemMN))][nemVl])
+        nemNamVc <- paste0(nemClaMC[, 1], ".", nemClaMC[, 2])
+        pfxNemVc <- paste0(varPfxC, nemNamVc)
+
+        ## omnibus and post-hoc tests
+        
+        nemMN <- t(apply(datMN, 2, function(varVn) {
+
+            pvaN <- kruskal.test(varVn ~ facFcVn)[["p.value"]]
+            varNemMN <- posthoc.kruskal.nemenyi.test(varVn, facFcVn, "Tukey")[["p.value"]]
+            c(pvaN, c(varNemMN))
+
+        }))
+
+        ## correction for multiple testing
+        
+        nemMN <- apply(nemMN, 2,
+                       function(pvaVn) p.adjust(pvaVn, method = adjC))
+        adjVn <- nemMN[, 1]
+        sigVn <- as.numeric(adjVn < thrN)
+        nemMN <- nemMN[, c(FALSE, nemVl)]
+        colnames(nemMN) <- paste0(pfxNemVc, "_", adjC)
+
+        ## significance coding (0 = not significant, 1 = significant)
+        
+        nemSigMN <- nemMN < thrN
+        mode(nemSigMN) <- "numeric"
+        colnames(nemSigMN) <- paste0(pfxNemVc, "_sig")
+
+        ## difference of the medians for each pairwise comparison
+        
+        difMN <- sapply(1:nrow(nemClaMC), function(prwI) {
+            prwVc <- nemClaMC[prwI, ]
+            prwVi <- which(facFcVn %in% prwVc)
+            prwFacFc <- factor(as.character(facFcVn)[prwVi], levels = prwVc)
+            apply(datMN[prwVi, ], 2, function(varVn) -diff(as.numeric(tapply(varVn, prwFacFc, function(x) median(x, na.rm = TRUE)))))
+        })
+        colnames(difMN) <- gsub("_sig", "_dif", colnames(nemSigMN))
+
+        ## final aggregated table
+        
+        resMN <- cbind(adjVn, sigVn, difMN, nemMN, nemSigMN)
+        colnames(resMN)[1:2] <- paste0(varPfxC, c(adjC, "sig"))
+
+        varDF <- cbind.data.frame(varDF, as.data.frame(resMN))
+
+        ## graphic
+
+        pdf(pdfC, onefile = TRUE)
+        
+        for(varI in 1:nrow(varDF)) {
+            
+            if(sum(nemSigMN[varI, ]) > 0) {
+                
+                varC <- rownames(varDF)[varI]
+
+                boxplot(datMN[, varI] ~ facFcVn,
+                        main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")"))
+                
+                for(nemI in 1:length(nemNamVc)) {
+                    
+                    if(nemSigMN[varI, paste0(varPfxC, nemNamVc[nemI], "_sig")] == 1) {
+                        
+                        nemClaVc <- nemClaMC[nemI, ]
+                        nemClaVl <- facFcVn %in% nemClaVc
+                        nemFc <- facFcVn[nemClaVl, drop = TRUE]
+                        nemVc <- as.character(nemFc)
+                        names(nemVc) <- rownames(samDF)[nemClaVl]
+                        boxF(nemFc,
+                             datMN[nemClaVl, varI],
+                             paste0(varC, " (", adjC, " = ", signif(nemMN[varI, paste0(varPfxC, nemNamVc[nemI], "_", adjC)], 2), ")"),
+                             nemVc)
+                        
+                    }
+                       
+                }
+                
+            }
+            
+        }
+
+        dev.off()
+        
+    }
+    
+    names(sigVn) <- rownames(varDF)
+    sigSumN <- sum(sigVn, na.rm = TRUE)
+    if(sigSumN) {
+        cat("\nThe following ", sigSumN, " variable", ifelse(sigSumN > 1, "s", ""), " (", round(sigSumN / length(sigVn) * 100), "%) ", ifelse(sigSumN > 1, "were", "was"), " found significant at the ", thrN, " level:\n", sep = "")
+        cat(paste(rownames(varDF)[sigVn > 0], collapse = "\n"), "\n", sep = "")
+    } else
+        cat("\nNo significant variable found at the selected ", thrN, " level\n", sep = "")
+
+    options(stingsAsFactors = strAsFacL)
+
+    return(varDF)
+
+}
+
+
+boxF <- function(xFc,
+                 yVn,
+                 maiC,
+                 xVc) {
+    
+    boxLs <- boxplot(yVn ~  xFc,
+                     main = maiC)
+    
+    outVn <- boxLs[["out"]]
+    
+    if(length(outVn)) {
+        
+        for(outI in 1:length(outVn)) {
+            levI <- which(levels(xFc) == xVc[names(outVn)[outI]])
+            text(levI,
+                 outVn[outI],
+                 labels = names(outVn)[outI],
+                 pos = ifelse(levI == 2, 2, 4))
+            }
+        
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/univariate_wrapper.R	Tue Oct 24 08:57:25 2017 -0400
@@ -0,0 +1,190 @@
+#!/usr/bin/env Rscript
+
+library(batch) ## parseCommandArgs
+
+# Constants
+argv <- commandArgs(trailingOnly = FALSE)
+script.path <- sub("--file=","",argv[grep("--file=",argv)])
+prog.name <- basename(script.path)
+
+# Print help
+if (length(grep('-h', argv)) >0) {
+	cat("Usage:", prog.name,
+	    "dataMatrix_in myDataMatrix.tsv",
+	    "sampleMetadata_in mySampleData.tsv",
+	    "variableMetadata_in myVariableMetadata.tsv",
+	    "facC qual",
+	    "tesC kruskal",
+	    "adjC fdr",
+	    "thrN 0.05",
+	    "variableMetadata_out myVariableMetadata_out.tsv",
+	    "figure figure.pdf",
+	    "information information.txt",
+		"\n")
+	quit(status = 0)
+}
+
+source_local <- function(fname){
+    argv <- commandArgs(trailingOnly = FALSE)
+    base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
+    source(paste(base_dir, fname, sep="/"))
+}
+
+source_local("univariate_script.R")
+
+argVc <- unlist(parseCommandArgs(evaluate=FALSE))
+
+##------------------------------
+## Initializing
+##------------------------------
+
+## options
+##--------
+
+strAsFacL <- options()$stringsAsFactors
+options(stringsAsFactors = FALSE)
+
+## packages
+##---------
+
+library(PMCMR)
+
+## constants
+##----------
+
+modNamC <- "Univariate" ## module name
+
+topEnvC <- environment()
+flagC <- "\n"
+
+## functions
+##----------
+
+flgF <- function(tesC,
+                 envC = topEnvC,
+                 txtC = NA) { ## management of warning and error messages
+
+    tesL <- eval(parse(text = tesC), envir = envC)
+
+    if(!tesL) {
+
+        sink(NULL)
+        stpTxtC <- ifelse(is.na(txtC),
+                          paste0(tesC, " is FALSE"),
+                          txtC)
+
+        stop(stpTxtC,
+             call. = FALSE)
+
+    }
+
+} ## flgF
+
+## log file
+##---------
+
+sink(argVc["information"])
+
+cat("\nStart of the '", modNamC, "' Galaxy module call: ",
+    format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
+
+## loading
+##--------
+
+datMN <- t(as.matrix(read.table(argVc["dataMatrix_in"],
+                                check.names = FALSE,
+                                header = TRUE,
+                                row.names = 1,
+                                sep = "\t")))
+
+samDF <- read.table(argVc["sampleMetadata_in"],
+                    check.names = FALSE,
+                    header = TRUE,
+                    row.names = 1,
+                    sep = "\t")
+
+varDF <- read.table(argVc["variableMetadata_in"],
+                    check.names = FALSE,
+                    header = TRUE,
+                    row.names = 1,
+                    sep = "\t")
+
+tesC <- argVc["tesC"]
+
+## checking
+##---------
+
+flgF("identical(rownames(datMN), rownames(samDF))", txtC = "Column names of the dataMatrix are not identical to the row names of the sampleMetadata; check your data with the 'Check Format' module in the 'Quality Control' section")
+flgF("identical(colnames(datMN), rownames(varDF))", txtC = "Row names of the dataMatrix are not identical to the row names of the variableMetadata; check your data with the 'Check Format' module in the 'Quality Control' section")
+
+flgF("argVc['facC'] %in% colnames(samDF)", txtC = paste0("Required factor of interest '", argVc['facC'], "' could not be found in the column names of the sampleMetadata"))
+flgF("mode(samDF[, argVc['facC']]) %in% c('character', 'numeric')", txtC = paste0("The '", argVc['facC'], "' column of the sampleMetadata should contain either number only, or character only"))
+
+flgF("!(tesC %in% c('ttest', 'wilcoxon')) || (mode(samDF[, argVc['facC']]) == 'character' && length(unique(samDF[, argVc['facC']])) == 2)", txtC = paste0("For 'ttest' and 'wilcoxon', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain characters with only two different classes"))
+flgF("!(tesC %in% c('anova', 'kruskal')) || (mode(samDF[, argVc['facC']]) == 'character' && length(unique(samDF[, argVc['facC']])) > 2)", txtC = paste0("For 'anova' and 'kruskal', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain characters with at least three different classes"))
+flgF("!(tesC %in% c('pearson', 'spearman')) || mode(samDF[, argVc['facC']]) == 'numeric'", txtC = paste0("For 'pearson' and 'spearman', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain numbers only"))
+
+flgF("argVc['adjC'] %in% c('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')")
+
+flgF("0 <= as.numeric(argVc['thrN']) && as.numeric(argVc['thrN']) <= 1",
+     txtC = "(corrected) p-value threshold must be between 0 and 1")
+
+
+##------------------------------
+## Computation
+##------------------------------
+
+
+varDF <- univariateF(datMN = datMN,
+                     samDF = samDF,
+                     varDF = varDF,
+                     facC = argVc["facC"],
+                     tesC = tesC,
+                     adjC = argVc["adjC"],
+                     thrN = as.numeric(argVc["thrN"]),
+                     pdfC = argVc["figure"])
+
+
+##------------------------------
+## Ending
+##------------------------------
+
+
+## saving
+##--------
+
+varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
+                          varDF)
+
+write.table(varDF,
+            file = argVc["variableMetadata_out"],
+            quote = FALSE,
+            row.names = FALSE,
+            sep = "\t")
+
+## closing
+##--------
+
+cat("\nEnd of '", modNamC, "' Galaxy module call: ",
+    as.character(Sys.time()), "\n", sep = "")
+
+cat("\n\n\n============================================================================")
+cat("\nAdditional information about the call:\n")
+cat("\n1) Parameters:\n")
+print(cbind(value = argVc))
+
+cat("\n2) Session Info:\n")
+sessioninfo <- sessionInfo()
+cat(sessioninfo$R.version$version.string,"\n")
+cat("Main packages:\n")
+for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
+cat("Other loaded packages:\n")
+for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
+
+cat("============================================================================\n")
+
+sink()
+
+options(stringsAsFactors = strAsFacL)
+
+rm(list = ls())