Next changeset 1:e194eec8e70c (2016-08-06) |
Commit message:
planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 217d97da5c733c3628997666c73867e81af0a0ee |
added:
LICENSE.md README.md build.xml checkFormat_config.xml checkFormat_script.R checkFormat_wrapper.R information.txt static/images/checkFormat_workflowPositionImage.png test-data/input-dataMatrix.tsv test-data/input-sampleMetadata.tsv test-data/input-variableMetadata.tsv test-data/output-information.txt tests/.Rhistory tests/checkFormat_tests.R tests/input/dataMatrix.tsv tests/input/sampleMetadata.tsv tests/input/variableMetadata.tsv tests/output/information.txt |
b |
diff -r 000000000000 -r 0d8099822c49 LICENSE.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE.md Sat Jul 30 12:06:35 2016 -0400 |
[ |
b'@@ -0,0 +1,517 @@\n+ CeCILL FREE SOFTWARE LICENSE AGREEMENT\n+\n+Version 2.1 dated 2013-06-21\n+\n+\n+ Notice\n+\n+This Agreement is a Free Software license agreement that is the result\n+of discussions between its authors in order to ensure compliance with\n+the two main principles guiding its drafting:\n+\n+ * firstly, compliance with the principles governing the distribution\n+ of Free Software: access to source code, broad rights granted to users,\n+ * secondly, the election of a governing law, French law, with which it\n+ is conformant, both as regards the law of torts and intellectual\n+ property law, and the protection that it offers to both authors and\n+ holders of the economic rights over software.\n+\n+The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) \n+license are: \n+\n+Commissariat \xe0 l\'\xe9nergie atomique et aux \xe9nergies alternatives - CEA, a\n+public scientific, technical and industrial research establishment,\n+having its principal place of business at 25 rue Leblanc, immeuble Le\n+Ponant D, 75015 Paris, France.\n+\n+Centre National de la Recherche Scientifique - CNRS, a public scientific\n+and technological establishment, having its principal place of business\n+at 3 rue Michel-Ange, 75794 Paris cedex 16, France.\n+\n+Institut National de Recherche en Informatique et en Automatique -\n+Inria, a public scientific and technological establishment, having its\n+principal place of business at Domaine de Voluceau, Rocquencourt, BP\n+105, 78153 Le Chesnay cedex, France.\n+\n+\n+ Preamble\n+\n+The purpose of this Free Software license agreement is to grant users\n+the right to modify and redistribute the software governed by this\n+license within the framework of an open source distribution model.\n+\n+The exercising of this right is conditional upon certain obligations for\n+users so as to preserve this status for all subsequent redistributions.\n+\n+In consideration of access to the source code and the rights to copy,\n+modify and redistribute granted by the license, users are provided only\n+with a limited warranty and the software\'s author, the holder of the\n+economic rights, and the successive licensors only have limited liability.\n+\n+In this respect, the risks associated with loading, using, modifying\n+and/or developing or reproducing the software by the user are brought to\n+the user\'s attention, given its Free Software status, which may make it\n+complicated to use, with the result that its use is reserved for\n+developers and experienced professionals having in-depth computer\n+knowledge. Users are therefore encouraged to load and test the\n+suitability of the software as regards their requirements in conditions\n+enabling the security of their systems and/or data to be ensured and,\n+more generally, to use and operate it in the same conditions of\n+security. This Agreement may be freely reproduced and published,\n+provided it is not altered, and that no provisions are either added or\n+removed herefrom.\n+\n+This Agreement may apply to any or all software for which the holder of\n+the economic rights decides to submit the use thereof to its provisions.\n+\n+Frequently asked questions can be found on the official website of the\n+CeCILL licenses family (http://www.cecill.info/index.en.html) for any \n+necessary clarification.\n+\n+\n+ Article 1 - DEFINITIONS\n+\n+For the purpose of this Agreement, when the following expressions\n+commence with a capital letter, they shall have the following meaning:\n+\n+Agreement: means this license agreement, and its possible subsequent\n+versions and annexes.\n+\n+Software: means the software in its Object Code and/or Source Code form\n+and, where applicable, its documentation, "as is" when the Licensee\n+accepts the Agreement.\n+\n+Initial Software: means the Software in its Source Code and possibly its\n+Object Code form and, where applicable, its documentation, "as is" when\n+it is first distributed under the terms and conditions of the Agreement.\n+\n+Modified Software: means the Software modified by at lea'..b"l be\n+decided on a case-by-case basis between the relevant Licensor and the\n+Licensee pursuant to a memorandum of understanding. The Licensor\n+disclaims any and all liability as regards the Licensee's use of the\n+name of the Software. No warranty is given as regards the existence of\n+prior rights over the name of the Software or as regards the existence\n+of a trademark.\n+\n+\n+ Article 10 - TERMINATION\n+\n+10.1 In the event of a breach by the Licensee of its obligations\n+hereunder, the Licensor may automatically terminate this Agreement\n+thirty (30) days after notice has been sent to the Licensee and has\n+remained ineffective.\n+\n+10.2 A Licensee whose Agreement is terminated shall no longer be\n+authorized to use, modify or distribute the Software. However, any\n+licenses that it may have granted prior to termination of the Agreement\n+shall remain valid subject to their having been granted in compliance\n+with the terms and conditions hereof.\n+\n+\n+ Article 11 - MISCELLANEOUS\n+\n+\n+ 11.1 EXCUSABLE EVENTS\n+\n+Neither Party shall be liable for any or all delay, or failure to\n+perform the Agreement, that may be attributable to an event of force\n+majeure, an act of God or an outside cause, such as defective\n+functioning or interruptions of the electricity or telecommunications\n+networks, network paralysis following a virus attack, intervention by\n+government authorities, natural disasters, water damage, earthquakes,\n+fire, explosions, strikes and labor unrest, war, etc.\n+\n+11.2 Any failure by either Party, on one or more occasions, to invoke\n+one or more of the provisions hereof, shall under no circumstances be\n+interpreted as being a waiver by the interested Party of its right to\n+invoke said provision(s) subsequently.\n+\n+11.3 The Agreement cancels and replaces any or all previous agreements,\n+whether written or oral, between the Parties and having the same\n+purpose, and constitutes the entirety of the agreement between said\n+Parties concerning said purpose. No supplement or modification to the\n+terms and conditions hereof shall be effective as between the Parties\n+unless it is made in writing and signed by their duly authorized\n+representatives.\n+\n+11.4 In the event that one or more of the provisions hereof were to\n+conflict with a current or future applicable act or legislative text,\n+said act or legislative text shall prevail, and the Parties shall make\n+the necessary amendments so as to comply with said act or legislative\n+text. All other provisions shall remain effective. Similarly, invalidity\n+of a provision of the Agreement, for any reason whatsoever, shall not\n+cause the Agreement as a whole to be invalid.\n+\n+\n+ 11.5 LANGUAGE\n+\n+The Agreement is drafted in both French and English and both versions\n+are deemed authentic.\n+\n+\n+ Article 12 - NEW VERSIONS OF THE AGREEMENT\n+\n+12.1 Any person is authorized to duplicate and distribute copies of this\n+Agreement.\n+\n+12.2 So as to ensure coherence, the wording of this Agreement is\n+protected and may only be modified by the authors of the License, who\n+reserve the right to periodically publish updates or new versions of the\n+Agreement, each with a separate number. These subsequent versions may\n+address new issues encountered by Free Software.\n+\n+12.3 Any Software distributed under a given version of the Agreement may\n+only be subsequently distributed under the same version of the Agreement\n+or a subsequent version, subject to the provisions of Article 5.3.4\n+<#compatibility>.\n+\n+\n+ Article 13 - GOVERNING LAW AND JURISDICTION\n+\n+13.1 The Agreement is governed by French law. The Parties agree to\n+endeavor to seek an amicable solution to any disagreements or disputes\n+that may arise during the performance of the Agreement.\n+\n+13.2 Failing an amicable solution within two (2) months as from their\n+occurrence, and unless emergency proceedings are necessary, the\n+disagreements or disputes shall be referred to the Paris Courts having\n+jurisdiction, by the more diligent Party.\n" |
b |
diff -r 000000000000 -r 0d8099822c49 README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Sat Jul 30 12:06:35 2016 -0400 |
[ |
@@ -0,0 +1,40 @@ +## Checking the formats of the dataMatrix, sampleMetadata, and variableMetadata files +#### A Galaxy module from the [Workflow4metabolomics](http://workflow4metabolomics.org) project + +Status: [![Build Status](https://travis-ci.org/workflow4metabolomics/checkformat.svg?branch=master)](https://travis-ci.org/workflow4metabolomics/checkformat). + +### Description + +**Version:** 2.0.2 +**Date:** 2016-07-29 +**Author:** Etienne A. Thevenot (CEA, LIST, MetaboHUB, W4M Core Development Team) +**Email:** [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) +**Licence:** CeCILL +**Reference histories:** +[W4M00001a_sacurine-subset-statistics](http://galaxy.workflow4metabolomics.org/history/list_published), [W4M00001b_sacurine_complete](http://galaxy.workflow4metabolomics.org/history/list_published), +[W4M00002_sacurine_mtbls2](http://galaxy.workflow4metabolomics.org/history/list_published), [W4M00003_sacurine_diaplasma](http://galaxy.workflow4metabolomics.org/history/list_published) +**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: **checkFormat_config.xml** +* Image file: **static/images/checkFormat_workflowPositionImage.png** +* Wrapper file: **checkFormat_wrapper.R** +* R packages + + **batch** from CRAN +> install.packages("batch", dep=TRUE) + +### Tests + +The code in the wrapper can be tested by running the **tests/checkFormat_tests.R** in R + +### News + +##### CHANGES IN VERSION 2.0.2 + +INTERNAL MODIFICATION + + o Creating tests for R code + +*** \ No newline at end of file |
b |
diff -r 000000000000 -r 0d8099822c49 build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.xml Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,78 @@ +<project name="checkformat" default="all"> + + <property name="tool.xml" value="checkFormat_config.xml"/> + <property name="conda.dir" value="${user.home}/w4m-conda"/> + + <!--~~~ + ~ ALL ~ + ~~~~~--> + + <target name="all"/> + + <!--~~~~ + ~ TEST ~ + ~~~~~--> + + <target name="test" depends="planemo.lint,planemo.test"/> + + <!--~~~~~~~~~~~~ + ~ 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.01"/> + <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> + + <!--~~~~~ + ~ CLEAN ~ + ~~~~~~--> + + <target name="clean"> + <delete dir="${conda.dir}"/> + </target> + +</project> |
b |
diff -r 000000000000 -r 0d8099822c49 checkFormat_config.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/checkFormat_config.xml Sat Jul 30 12:06:35 2016 -0400 |
[ |
@@ -0,0 +1,212 @@ +<tool id="checkFormat" name="Check Format" version="2.0.2"> + <description>Checks the formats of the dataMatrix, sampleMetadata, and variableMetadata files</description> + + <requirements> + <requirement type="package" version="3.2.2">R</requirement> + <requirement type="package">r-batch</requirement> + </requirements> + + <command><![CDATA[ + Rscript $__tool_directory__/checkFormat_wrapper.R + dataMatrix_in "$dataMatrix_in" + sampleMetadata_in "$sampleMetadata_in" + variableMetadata_in "$variableMetadata_in" + + information "$information" + ]]></command> + + <inputs> + <param name="dataMatrix_in" type="data" label="Data matrix file" help="" format="tabular" /> + <param name="sampleMetadata_in" type="data" label="Sample metadata file" help="" format="tabular" /> + <param name="variableMetadata_in" type="data" label="Variable metadata file" help="" format="tabular" /> + </inputs> + + <outputs> + <data name="information" label="${tool.name}_information.txt" format="txt"/> + </outputs> + + <tests> + <test> + <param name="dataMatrix_in" value="input-dataMatrix.tsv"/> + <param name="sampleMetadata_in" value="input-sampleMetadata.tsv"/> + <param name="variableMetadata_in" value="input-variableMetadata.tsv"/> + <output name="information" file="output-information.txt" lines_diff="4"/> + </test> + </tests> + + <help> + +.. class:: infomark + +**Author** Etienne Thevenot (W4M Core Development Team, MetaboHUB Paris, CEA) + +--------------------------------------------------- + +.. class:: infomark + +**Tool updates** + +See the **NEWS** section at the bottom of this page + +--------------------------------------------------- + +======================== +Check Format +======================== + +----------- +Description +----------- + +| Checks the format (row and column names) of the dataMatrix, sampleMetadata and variableMetadata tables + + +----------------- +Workflow position +----------------- + +.. image:: ./static/images/checkFormat_workflowPositionImage.png +:width: 600 + + + +----------- +Input files +----------- + ++----------------------------+---------+ +| Parameter : num + label | Format | ++============================+=========+ +| 1 : Data matrix file | tabular | ++----------------------------+---------+ +| 2 : Sample metadata file | tabular | ++----------------------------+---------+ +| 3 : Variable metadata file | tabular | ++----------------------------+---------+ + +| +| **Required formats for the dataMatrix, sampleMetadata, and variableMetadata files are** +| **described in the HowTo entitled 'Format Data For Postprocessing' available on the** +| **main page of Workflow4Metabolomics.org** +| + +------------ +Output files +------------ + +information.txt +| Text file with all messages when error(s) in formats are detected +| + +--------------------------------------------------- + +--------------- +Working example +--------------- + +.. class:: infomark + +See the **W4M00001a_sacurine-subset-statistics**, **W4M00001b_sacurine-complete**, **W4M00002_mtbls2**, or **W4M00003_diaplasma** shared histories in the **Shared Data/Published Histories** menu + +--------------------------------------------------- + +---- +NEWS +---- + +CHANGES IN VERSION 2.0.2 +======================== + +INTERNAL MODIFICATIONS + +Test for R code +Planemo running validation +Planemo installing validation +Travis automated testing +Toolshed export + + </help> + + <citations> + <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 = {Thévenot, Etienne A. and Roux, Aurélie 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> + + </citations> + + --------------- + Working example + --------------- + + + Input files + =========== + + | **To generate the "dataMatrix", "sampleMetadata" and "variableMetadata" files:** + | **1) copy/paste the values below in three distinct .txt files** + | **2) use the "Get Data" / "Upload File" in the "Tools" (left) panel from the Galaxy / ABiMS page by choosing:** + | **a) File Format: 'tabular'** + | **b) Convert spaces to tabs: 'Yes'** + | + + **dataMatrix file**:: + + dataMatrix HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 + HMDB01032 2569204.92420381 6222035.77434915 17070707.9912636 1258838.24348419 13039543.0754619 1909391.77026598 3495.09386434063 2293521.90928998 128503.275117713 81872.5276382213 8103557.56578035 149574887.036181 1544036.41049333 7103429.53933206 14138796.50382 4970265.57952158 263054.73056162 1671332.30008058 88433.1944958815 23602331.2894815 18648126.5206986 1554657.98756878 34152.3646391152 209372.71275317 33187733.370626 202438.591636003 13581070.0886437 354170.810678102 9120781.48986975 43419175.4051586 + HMDB03072 3628416.30251025 65626.9834353751 112170.118946651 3261804.34422417 42228.2787747563 343254.201250707 1958217.69317664 11983270.0435677 5932111.41638028 5511385.83359531 9154521.47755199 2632133.21209418 9500411.14556502 6551644.51726592 7204319.80891836 1273412.04795188 3260583.81592376 8932005.5351622 8340827.52597275 9256460.69197759 11217839.169041 5919262.81433556 11790077.0657915 9567977.80797097 73717.5811684739 9991787.29074293 4208098.14739633 623970.649925847 10904221.2642849 2171793.93621067 + HMDB00792 429568.609438384 3887629.50527037 1330692.11658995 1367446.73023821 844197.447472453 2948090.71886592 1614157.90566884 3740009.19379795 3292251.66531919 2310688.79492013 4404239.59008605 3043289.12780863 825736.467181043 2523241.91730649 6030501.02648005 474901.604069803 2885792.42617652 2955990.64049134 1917716.3427982 1767962.67737699 5926203.40397675 1639065.69474684 346810.763557826 1054776.22313737 2390258.27543894 1831346.37315857 1026696.36904362 7079792.50047866 4368341.01359769 3495986.87280275 + + + **sampleMetadata file**:: + + sampleMetadata age ageGrp + HU_017 41 experienced + HU_021 34 junior + HU_027 37 experienced + HU_032 38 experienced + HU_041 28 junior + HU_048 39 experienced + HU_049 50 senior + HU_050 30 junior + HU_052 51 senior + HU_059 81 senior + HU_060 55 senior + HU_066 25 junior + HU_072 47 experienced + HU_077 27 junior + HU_091 46 experienced + HU_109 32 junior + HU_110 50 senior + HU_125 58 senior + HU_126 45 experienced + HU_131 42 experienced + HU_134 48 experienced + HU_149 35 experienced + HU_150 49 experienced + HU_173 55 senior + HU_179 33 junior + HU_180 53 senior + HU_182 43 experienced + HU_202 42 experienced + HU_204 31 junior + HU_209 17.5 junior + + + **variableMetadata file**:: + + variableMetadata name + HMDB01032 Dehydroepiandrosterone sulfate + HMDB03072 Quinic acid + HMDB00792 Sebacic acid + +</tool> |
b |
diff -r 000000000000 -r 0d8099822c49 checkFormat_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/checkFormat_script.R Sat Jul 30 12:06:35 2016 -0400 |
[ |
b'@@ -0,0 +1,186 @@\n+## Etienne Thevenot\n+## CEA, MetaboHUB Paris\n+## etienne.thevenot@cea.fr\n+\n+\n+## Reads the dataMatrix, sampleMetadata, and variableMetadata .tsv files\n+## and checks the formats\n+readAndCheckF <- function(datFilC="dataMatrix.tsv",\n+ samFilC="sampleMetadata.tsv",\n+ varFilC="variableMetadata.tsv") {\n+\n+ ## options\n+\n+ optStrAsFacL <- options()[["stringsAsFactors"]]\n+ options(stringsAsFactors = FALSE)\n+\n+ ## checking that the tables have no duplicated row or column names\n+\n+ for(tabC in c("dat", "sam", "var")) {\n+\n+ tabNamC <- switch(tabC, dat="dataMatrix", sam="sampleMetadata", var="variableMetadata")\n+\n+ rowVc <- read.table(eval(parse(text=paste0(tabC, "FilC"))),\n+ check.names = FALSE,\n+ header = TRUE,\n+ sep = "\\t")[, 1]\n+\n+ colVc <- unlist(read.table(eval(parse(text=paste0(tabC, "FilC"))),\n+ check.names = FALSE,\n+ nrow=1,\n+ sep = "\\t"))[-1]\n+\n+ if(any(duplicated(rowVc)))\n+ stop("The following row name(s) is/are duplicated in the ",\n+ tabNamC,\n+ " table: \'",\n+ paste(rowVc[duplicated(rowVc)], collapse="\', \'"), "\'",\n+ call.=FALSE)\n+\n+ if(any(duplicated(colVc)))\n+ stop("The following column name(s) is/are duplicated in the ",\n+ tabNamC,\n+ " table: \'",\n+ paste(colVc[duplicated(colVc)], collapse="\', \'"), "\'",\n+ call.=FALSE)\n+\n+ rowMakVc <- make.names(rowVc, unique = TRUE)\n+\n+ rowDifVl <- rowVc != rowMakVc\n+\n+ if(any(rowDifVl)) {\n+ rowDifDF <- data.frame(row = 1:length(rowVc),\n+ actual = rowVc,\n+ preferred = rowMakVc)\n+ rowDifDF <- rowDifDF[rowDifVl, , drop = FALSE]\n+ cat("\\n\\nWarning: The following row names of the ",\n+ tabNamC,\n+ " table are not in the standard R format, which may result in errors when loading the data in some of the W4M modules:\\n", sep="")\n+ print(rowDifDF)\n+ }\n+\n+ colMakVc <- make.names(colVc, unique = TRUE)\n+\n+ colDifVl <- colVc != colMakVc\n+\n+ if(any(colDifVl)) {\n+ colDifDF <- data.frame(col = 1:length(colVc),\n+ actual = colVc,\n+ preferred = colMakVc)\n+ colDifDF <- colDifDF[colDifVl, , drop = FALSE]\n+ cat("\\n\\nWarning: The following column names of the ",\n+ tabNamC,\n+ " table are not in the standard R format, which may result in errors when loading the data in some of the W4M modules:\\n", sep="")\n+ print(colDifDF)\n+ }\n+ }\n+\n+ ## reading tables\n+\n+ datMN <- t(as.matrix(read.table(datFilC,\n+ check.names = FALSE,\n+ header = TRUE,\n+ row.names = 1,\n+ sep = "\\t")))\n+\n+ samDF <- read.table(samFilC,\n+ check.names = FALSE,\n+ header = TRUE,\n+ row.names = 1,\n+ sep = "\\t")\n+\n+ varDF <- read.table(varFilC,\n+ check.names = FALSE,\n+ header = TRUE,\n+ row.names = 1,\n+ sep = "\\t")\n+\n+ ## checking formats\n+\n+ chkL <- TRUE\n+\n+ if(!identical(rownames(datMN), rownames(samDF))) {\n+ ## checking sample names\n+\n+ chkL <- FALSE\n+\n+ datSamDifVc <- setdiff(rownames(datMN), rownames(samDF))\n+\n+ if(length(datSamDifVc)) {\n+ cat("\\nThe following samples were found in the dataMatrix col'..b'))\n+\n+ if(length(samDatDifVc)) {\n+ cat("\\n\\nThe following samples were found in the sampleMetadata row names but not in the dataMatrix column names:\\n", sep="")\n+ print(cbind.data.frame(row = as.numeric(sapply(samDatDifVc, function(samC) which(rownames(samDF) == samC))),\n+ name = samDatDifVc))\n+ }\n+\n+ if(nrow(datMN) != nrow(samDF)) {\n+ cat("\\n\\nThe dataMatrix has ", nrow(datMN), " columns (ie samples) whereas the sampleMetadata has ", nrow(samDF), " rows\\n", sep="")\n+ } else if(identical(gsub("^X", "", rownames(datMN)), rownames(samDF))) {\n+ cat("\\n\\nThe dataMatrix column names start with an \'X\' but not the sampleMetadata row names\\n", sep="")\n+ } else if(identical(gsub("^X", "", rownames(samDF)), rownames(datMN))) {\n+ cat("\\n\\nThe sampleMetadata row names start with an \'X\' but not the dataMatrix column names\\n", sep="")\n+ } else if(identical(sort(rownames(datMN)), sort(rownames(samDF)))) {\n+ cat("\\n\\nThe dataMatrix column names and the sampleMetadata row names are not in the same order:\\n", sep="")\n+ print(cbind.data.frame(indice = 1:nrow(datMN),\n+ dataMatrix_columnnames=rownames(datMN),\n+ sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])\n+ } else {\n+ cat("\\n\\nThe dataMatrix column names and the sampleMetadata row names are not identical:\\n", sep="")\n+ print(cbind.data.frame(indice = 1:nrow(datMN),\n+ dataMatrix_columnnames=rownames(datMN),\n+ sampleMetadata_rownames=rownames(samDF))[rownames(datMN) != rownames(samDF), , drop = FALSE])\n+ }\n+\n+ }\n+\n+ if(!identical(colnames(datMN), rownames(varDF))) {\n+ ## checking variable names\n+\n+ chkL <- FALSE\n+\n+ datVarDifVc <- setdiff(colnames(datMN), rownames(varDF))\n+\n+ if(length(datVarDifVc)) {\n+ cat("\\nThe following variables were found in the dataMatrix row names but not in the variableMetadata row names:\\n", sep="")\n+ print(cbind.data.frame(row = as.numeric(sapply(datVarDifVc, function(varC) which(colnames(datMN) == varC))),\n+ name = datVarDifVc))\n+\n+ }\n+\n+ varDatDifVc <- setdiff(rownames(varDF), colnames(datMN))\n+\n+ if(length(varDatDifVc)) {\n+ cat("\\n\\nThe following variables were found in the variableMetadata row names but not in the dataMatrix row names:\\n", sep="")\n+ print(cbind.data.frame(row = as.numeric(sapply(varDatDifVc, function(varC) which(rownames(varDF) == varC))),\n+ name = varDatDifVc))\n+ }\n+\n+ if(ncol(datMN) != nrow(varDF)) {\n+ cat("\\n\\nThe dataMatrix has ", nrow(datMN), " rows (ie variables) whereas the variableMetadata has ", nrow(varDF), " rows\\n", sep="")\n+ } else if(identical(sort(colnames(datMN)), sort(rownames(varDF)))) {\n+ cat("\\n\\nThe dataMatrix row names and the variableMetadata row names are not in the same order:\\n", sep="")\n+ print(cbind.data.frame(row = 1:ncol(datMN),\n+ dataMatrix_rownames=colnames(datMN),\n+ variableMetadata_rownames=rownames(varDF))[colnames(datMN) != rownames(varDF), , drop = FALSE])\n+ } else {\n+ cat("\\n\\nThe dataMatrix row names and the variableMetadata row names are not identical:\\n", sep="")\n+ print(cbind.data.frame(row = 1:ncol(datMN),\n+ dataMatrix_rownames=colnames(datMN),\n+ variableMetadata_rownames=rownames(varDF))[colnames(datMN) != rownames(varDF), , drop = FALSE])\n+ }\n+ }\n+\n+ options(stringsAsFactors=optStrAsFacL)\n+\n+ resLs <- list(chkL=chkL)\n+\n+ return(resLs)\n+\n+} ## end of checkAndReadF\n' |
b |
diff -r 000000000000 -r 0d8099822c49 checkFormat_wrapper.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/checkFormat_wrapper.R Sat Jul 30 12:06:35 2016 -0400 |
[ |
@@ -0,0 +1,77 @@ +#!/usr/bin/Rscript --vanilla --slave --no-site-file + +library(batch) ## parseCommandArgs + +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("checkFormat_script.R") + +argVc <- unlist(parseCommandArgs(evaluate = FALSE)) + + +##------------------------------ +## Initializing +##------------------------------ + +## options +##-------- + +strAsFacL <- options()$stringsAsFactors +options(stringsAsFactors = FALSE) + +## constants +##---------- + +modNamC <- "Check Format" ## module name + +## log file +##--------- + +sink(argVc["information"]) + +cat("\nStart of the '", modNamC, "' Galaxy module call: ", + format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") + + +##------------------------------ +## Computation +##------------------------------ + + +resLs <- readAndCheckF(argVc["dataMatrix_in"], + argVc["sampleMetadata_in"], + argVc["variableMetadata_in"]) +chkL <- resLs[["chkL"]] + + +##------------------------------ +## Ending +##------------------------------ + + +if(chkL) { + + cat("\nTable formats are OK; enjoy your analyses!\n", sep="") + + cat("\nEnd of the '", modNamC, "' Galaxy module call: ", + format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") + + sink() + +} else { + + sink() + stop("Please check the generated 'information' file") + +} + +## closing +##-------- + +options(stringsAsFactors = strAsFacL) + +rm(list = ls()) |
b |
diff -r 000000000000 -r 0d8099822c49 information.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/information.txt Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,2 @@ + +Start of the 'Check Format' Galaxy module call: Sat 30 Jul 2016 07:21:35 AM |
b |
diff -r 000000000000 -r 0d8099822c49 static/images/checkFormat_workflowPositionImage.png |
b |
Binary file static/images/checkFormat_workflowPositionImage.png has changed |
b |
diff -r 000000000000 -r 0d8099822c49 test-data/input-dataMatrix.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input-dataMatrix.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,4 @@ +dataMatrix HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 +HMDB01032 2569204.924 6222035.774 17070707.99 1258838.243 13039543.08 1909391.77 3495.093864 2293521.909 128503.2751 81872.52764 8103557.566 149574887 1544036.41 7103429.539 14138796.5 4970265.58 263054.7306 1671332.3 88433.1945 23602331.29 18648126.52 1554657.988 34152.36464 209372.7128 33187733.37 202438.5916 13581070.09 354170.8107 9120781.49 43419175.41 +HMDB03072 3628416.303 65626.98344 112170.1189 3261804.344 42228.27877 343254.2013 1958217.693 11983270.04 5932111.416 5511385.834 9154521.478 2632133.212 9500411.146 6551644.517 7204319.809 1273412.048 3260583.816 8932005.535 8340827.526 9256460.692 11217839.17 5919262.814 11790077.07 9567977.808 73717.58117 9991787.291 4208098.147 623970.6499 10904221.26 2171793.936 +HMDB00792 429568.6094 3887629.505 1330692.117 1367446.73 844197.4475 2948090.719 1614157.906 3740009.194 3292251.665 2310688.795 4404239.59 3043289.128 825736.4672 2523241.917 6030501.026 474901.6041 2885792.426 2955990.64 1917716.343 1767962.677 5926203.404 1639065.695 346810.7636 1054776.223 2390258.275 1831346.373 1026696.369 7079792.5 4368341.014 3495986.873 |
b |
diff -r 000000000000 -r 0d8099822c49 test-data/input-sampleMetadata.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input-sampleMetadata.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,31 @@ +sampleMetadata age ageGrp +HU_017 41 experienced +HU_021 34 junior +HU_027 37 experienced +HU_032 38 experienced +HU_041 28 junior +HU_048 39 experienced +HU_049 50 senior +HU_050 30 junior +HU_052 51 senior +HU_059 81 senior +HU_060 55 senior +HU_066 25 junior +HU_072 47 experienced +HU_077 27 junior +HU_090 46 experienced +HU_109 32 junior +HU_110 50 senior +HU_125 58 senior +HU_126 45 experienced +HU_131 42 experienced +HU_134 48 experienced +HU_149 35 experienced +HU_150 49 experienced +HU_173 55 senior +HU_179 33 junior +HU_180 53 senior +HU_182 43 experienced +HU_202 42 experienced +HU_204 31 junior +HU_209 17.5 junior |
b |
diff -r 000000000000 -r 0d8099822c49 test-data/input-variableMetadata.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input-variableMetadata.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,4 @@ +variableMetadata name +HMDB01032 Dehydroepiandrosterone sulfate +HMDB03072 Quinic acid +HMDB00792 Sebacic acid |
b |
diff -r 000000000000 -r 0d8099822c49 test-data/output-information.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/output-information.txt Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,6 @@ + +Start of the 'Check Format' Galaxy module call: Sat 30 Jul 2016 07:49:51 AM + +Table formats are OK; enjoy your analyses! + +End of the 'Check Format' Galaxy module call: Sat 30 Jul 2016 07:49:51 AM |
b |
diff -r 000000000000 -r 0d8099822c49 tests/.Rhistory --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/.Rhistory Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,1 @@ +q("no") |
b |
diff -r 000000000000 -r 0d8099822c49 tests/checkFormat_tests.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/checkFormat_tests.R Sat Jul 30 12:06:35 2016 -0400 |
[ |
@@ -0,0 +1,116 @@ +#!/usr/bin/env Rscript + +## Package +##-------- + +library(RUnit) + +## Constants +##---------- + +tesOutDirC <- "output" + +## Functions +##----------- + +## Reading tables (matrix or data frame) +reaTabF <- function(filC, typC = c("matrix", "dataframe")[1]) { + + file.exists(filC) || stop(paste0("No output file \"", filC ,"\".")) + + switch(typC, + matrix = return(t(as.matrix(read.table(file = filC, + header = TRUE, + row.names = 1, + sep = "\t", + stringsAsFactors = FALSE)))), + dataframe = return(read.table(file = filC, + header = TRUE, + row.names = 1, + sep = "\t", + stringsAsFactors = FALSE))) + +} + +## Call wrapper +wrpCalF <- function(parLs) { + + ## Set program path + wrpPatC <- file.path("..", "checkFormat_wrapper.R") + + ## Set arguments + argLs <- NULL + for (parC in names(parLs)) + argLs <- c(argLs, parC, parLs[[parC]]) + + ## Call + wrpCalC <- paste(c(wrpPatC, argLs), collapse = " ") + + if(.Platform$OS.type == "windows") + wrpCalC <- paste("Rscript", wrpCalC) + + wrpCodN <- system(wrpCalC) + + if (wrpCodN != 0) + stop("Error when running checkFormat_wrapper.R.") + + ## Get output + outLs <- list() + if ("dataMatrix_out" %in% names(parLs)) + outLs[["datMN"]] <- reaTabF(parLs[["dataMatrix_out"]], "matrix") + if ("sampleMetadata_out" %in% names(parLs)) + outLs[["samDF"]] <- reaTabF(parLs[["sampleMetadata_out"]], "dataframe") + if ("variableMetadata_out" %in% names(parLs)) + outLs[["varDF"]] <- reaTabF(parLs[["variableMetadata_out"]], "dataframe") + if("information" %in% names(parLs)) + outLs[["infVc"]] <- readLines(parLs[["information"]]) + + return(outLs) +} + +## Setting default parameters +argDefF <- function(tesC) { + + tesInpDirC <- unlist(strsplit(tesC, "_"))[1] + + argDefLs <- list() + if(file.exists(file.path(tesInpDirC, "dataMatrix.tsv"))) + argDefLs[["dataMatrix_in"]] <- file.path(tesInpDirC, "dataMatrix.tsv") + if(file.exists(file.path(tesInpDirC, "sampleMetadata.tsv"))) + argDefLs[["sampleMetadata_in"]] <- file.path(tesInpDirC, "sampleMetadata.tsv") + if(file.exists(file.path(tesInpDirC, "variableMetadata.tsv"))) + argDefLs[["variableMetadata_in"]] <- file.path(tesInpDirC, "variableMetadata.tsv") + if(file.exists(file.path(tesOutDirC, "dataMatrix.tsv"))) + argDefLs[["dataMatrix_out"]] <- file.path(tesOutDirC, "dataMatrix.tsv") + if(file.exists(file.path(tesOutDirC, "sampleMetadata.tsv"))) + argDefLs[["sampleMetadata_out"]] <- file.path(tesOutDirC, "sampleMetadata.tsv") + if(file.exists(file.path(tesOutDirC, "variableMetadata.tsv"))) + argDefLs[["variableMetadata_out"]] <- file.path(tesOutDirC, "variableMetadata.tsv") + + ## argDefLs[["figure"]] <- file.path(tesOutDirC, "figure.pdf") + argDefLs[["information"]] <- file.path(tesOutDirC, "information.txt") + + argDefLs + +} + +## Main +##----- + +## Create output folder + +file.exists(tesOutDirC) || dir.create(tesOutDirC) + +test_input_default <- function() { + + tesC <- "input_default" + chkC <- "checkEquals(outLs[['infVc']][4], 'Table formats are OK; enjoy your analyses!')" + + argLs <- argDefF(tesC = tesC) + outLs <- wrpCalF(argLs) + stopifnot(eval(parse(text = chkC))) + +} + + + |
b |
diff -r 000000000000 -r 0d8099822c49 tests/input/dataMatrix.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/input/dataMatrix.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,4 @@ +dataMatrix HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 +HMDB01032 2569204.924 6222035.774 17070707.99 1258838.243 13039543.08 1909391.77 3495.093864 2293521.909 128503.2751 81872.52764 8103557.566 149574887 1544036.41 7103429.539 14138796.5 4970265.58 263054.7306 1671332.3 88433.1945 23602331.29 18648126.52 1554657.988 34152.36464 209372.7128 33187733.37 202438.5916 13581070.09 354170.8107 9120781.49 43419175.41 +HMDB03072 3628416.303 65626.98344 112170.1189 3261804.344 42228.27877 343254.2013 1958217.693 11983270.04 5932111.416 5511385.834 9154521.478 2632133.212 9500411.146 6551644.517 7204319.809 1273412.048 3260583.816 8932005.535 8340827.526 9256460.692 11217839.17 5919262.814 11790077.07 9567977.808 73717.58117 9991787.291 4208098.147 623970.6499 10904221.26 2171793.936 +HMDB00792 429568.6094 3887629.505 1330692.117 1367446.73 844197.4475 2948090.719 1614157.906 3740009.194 3292251.665 2310688.795 4404239.59 3043289.128 825736.4672 2523241.917 6030501.026 474901.6041 2885792.426 2955990.64 1917716.343 1767962.677 5926203.404 1639065.695 346810.7636 1054776.223 2390258.275 1831346.373 1026696.369 7079792.5 4368341.014 3495986.873 |
b |
diff -r 000000000000 -r 0d8099822c49 tests/input/sampleMetadata.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/input/sampleMetadata.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,31 @@ +sampleMetadata age ageGrp +HU_017 41 experienced +HU_021 34 junior +HU_027 37 experienced +HU_032 38 experienced +HU_041 28 junior +HU_048 39 experienced +HU_049 50 senior +HU_050 30 junior +HU_052 51 senior +HU_059 81 senior +HU_060 55 senior +HU_066 25 junior +HU_072 47 experienced +HU_077 27 junior +HU_090 46 experienced +HU_109 32 junior +HU_110 50 senior +HU_125 58 senior +HU_126 45 experienced +HU_131 42 experienced +HU_134 48 experienced +HU_149 35 experienced +HU_150 49 experienced +HU_173 55 senior +HU_179 33 junior +HU_180 53 senior +HU_182 43 experienced +HU_202 42 experienced +HU_204 31 junior +HU_209 17.5 junior |
b |
diff -r 000000000000 -r 0d8099822c49 tests/input/variableMetadata.tsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/input/variableMetadata.tsv Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,4 @@ +variableMetadata name +HMDB01032 Dehydroepiandrosterone sulfate +HMDB03072 Quinic acid +HMDB00792 Sebacic acid |
b |
diff -r 000000000000 -r 0d8099822c49 tests/output/information.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/output/information.txt Sat Jul 30 12:06:35 2016 -0400 |
b |
@@ -0,0 +1,6 @@ + +Start of the 'Check Format' Galaxy module call: Sat 30 Jul 2016 07:49:51 AM + +Table formats are OK; enjoy your analyses! + +End of the 'Check Format' Galaxy module call: Sat 30 Jul 2016 07:49:51 AM |