changeset 0:bba4cafe21a8 draft

planemo upload for repository https://github.com/asaim/galaxytools/tree/master/tools/compute_wilcoxon_test commit 5c45ed58045ce1686aa069403f8a9426ea20bac5-dirty
author bebatut
date Tue, 12 Apr 2016 02:56:51 -0400
parents
children ff9e8750bb26
files compute_wilcoxon_test.R compute_wilcoxon_test.xml test-data/input_file.txt test-data/output_file.txt tool_dependencies.xml
diffstat 5 files changed, 375 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compute_wilcoxon_test.R	Tue Apr 12 02:56:51 2016 -0400
@@ -0,0 +1,51 @@
+library('getopt')
+
+option_specification = matrix(c(
+  'input_file', 'a', 2, 'character',
+  'output_file', 'b', 2, 'character',
+  'column1_id', 'c', 2, 'integer',
+  'column2_id', 'd', 2, 'integer',
+  'alternative','e',2,'character',
+  'paired','f',2,'logical',
+  'exact','g',2,'logical',
+  'correct','h',2, 'logical',
+  'mu','i',2,'integer'
+), byrow=TRUE, ncol=4);
+
+options = getopt(option_specification);
+
+data = read.table(options$input_file, sep = '\t', h = T)
+
+column1_id = 1
+if(!is.null(options$column1_id)) column1_id = options$column1_id
+x = data[,column1_id]
+y = NULL
+if(!is.null(options$column2_id)) y = data[,options$column2_id]
+
+alternative = 'two.sided'
+if(!is.null(options$alternative)) alternative = options$alternative
+
+mu = 0
+if(!is.null(options$mu)) mu = options$mu
+
+paired = FALSE
+if(!is.null(options$paired)) paired = options$paired
+
+exact = NULL
+if(!is.null(options$exact)) exact = options$exact
+
+correct = TRUE
+if(!is.null(options$correct)) correct = options$correct
+
+test = wilcox.test(x = x, y = y, alternative = alternative, mu = mu, 
+    paired = paired, exact = exact, correct = correct)
+
+m = matrix(ncol = 2, nrow = 6)
+m[1,] = c('statistic',test$statistic)
+m[2,] = c('parameter',test$parameter)
+m[3,] = c('p.value',test$p.value)
+m[4,] = c('null.value',test$null.value)
+m[5,] = c('alternative',test$alternative)
+m[6,] = c('method',test$method)
+write.table(m, file = options$output_file, sep = "\t", quote = FALSE, 
+    row.names = FALSE, col.names = FALSE)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compute_wilcoxon_test.xml	Tue Apr 12 02:56:51 2016 -0400
@@ -0,0 +1,90 @@
+<tool id="compute_wilcoxon_test" name="Compute Wilcoxon test" version="0.1.0">
+    <description>with R</description>
+
+    <requirements>
+        <requirement type="package" version="3.2.1">R</requirement>
+        <requirement type="package" version="1.20.0">getopt</requirement>
+    </requirements>
+
+    <stdio>
+        <exit_code range="1:" />
+        <exit_code range=":-1" />
+    </stdio>
+
+    <version_command></version_command>
+
+    <command><![CDATA[
+        Rscript $__tool_directory__/compute_wilcoxon_test.R
+            --input_file $input_file
+            --output_file $output_file
+            --column1_id $column1_id
+
+            #if $add_data.test == 'true':
+                --column2_id $add_data.column2_id
+                --paired $add_data.paired
+            #end if
+
+            --alternative "$alternative"
+            --mu $mu
+            
+            --exact $exact
+            --correct $correct
+            
+    ]]></command>
+
+    <inputs>
+        <param name="input_file" type="data" format="tabular,tsv,csv" label="Input file" help="File in tabular format with tab-separated columns and header in first line (--input_file)"/>
+
+        <param name="column1_id" type="data_column" data_ref="input_file" label="Column containing data" multiple="false" numerical="true" help="(--column1_id)"/>
+
+        <conditional name="add_data">
+            <param name="test" label="Add a new column?" type="select" help="(--alternative)">
+                <option value="true" selected="True">Yes</option>
+                <option value="false">No</option>
+            </param>
+            <when value="true">
+                <param name="column2_id" type="data_column" data_ref="input_file" label="Column containing data" multiple="false" numerical="true" help="(--column2_id)"/>
+                <param name="paired" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Paired datasets?" checked="false" help="(--paired)"/>
+            </when>
+            <when value="false" />
+        </conditional>
+
+        <param name="alternative" label="Alternative hypothesis" type="select" help="(--alternative)">
+            <option value="two.sided" selected="True">Two sided</option>
+            <option value="greater">Greater</option>
+            <option value="less">Less</option>
+        </param>
+        <param name="mu" type="integer" value="0" label="Optional parameter used to form the null hypothesis" help="(--mu)"/>
+        
+        <param name="exact" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Compute an exact p-value?" checked="false" help="(--exact)"/>
+        <param name="correct" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Apply a continuity correction in the normal approximation for the p-value?" checked="true" help="(--correct)"/>
+    </inputs>
+
+    <outputs>
+        <data name="output_file" format="text"
+            label="${tool.name} on ${on_string}: Wilcox test result" />
+    </outputs>
+
+    <tests>
+        <param name="input_file" value="input_file.txt" />
+        <param name="column1_id" value="2" />
+        <param name="test" value="true" />
+        <param name="column2_id" value="3" />
+        <param name="paired" value="TRUE" />
+        <param name="alternative" value="two.sided" />
+        <param name="mu" value="0" />
+        <param name="exact" value="FALSE" />
+        <param name="correct" value="TRUE"/>
+        <output name="output_file" value="output_file.txt" />
+    </tests>
+
+    <help><![CDATA[
+        **What it does**
+
+        This tool compute a Wilcoxon test with R's wilcox.test function.
+
+    ]]></help>
+
+    <citations>
+    </citations>
+</tool>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input_file.txt	Tue Apr 12 02:56:51 2016 -0400
@@ -0,0 +1,219 @@
+1CMET2-PWY	0.175035	0.0362591
+ALLANTOINDEG-PWY	0.0242562	0.00460458
+ANAEROFRUCAT-PWY	0.217334	0.0455255
+ANAGLYCOLYSIS-PWY	0.281499	0.0629425
+ARGDEG-PWY	0.0596968	0.0103622
+ARGININE-SYN4-PWY	0.0573312	0.0491229
+ARGORNPROST-PWY	0.242842	0.0422785
+ARG+POLYAMINE-SYN	0.0310286	0.00566196
+ARGSYNBSUB-PWY	0.317406	0.0581645
+ARGSYN-PWY	0.386519	0.0687025
+ARO-PWY	0.230647	0.026966
+ASPASN-PWY	0.0946122	0.0522461
+AST-PWY	0.0287623	0.00643
+BIOTIN-BIOSYNTHESIS-PWY	0.0973993	0.0199678
+BRANCHED-CHAIN-AA-SYN-PWY	0.512372	0.167303
+CALVIN-PWY	0.278484	0.0422659
+CATECHOL-ORTHO-CLEAVAGE-PWY	0.00119794	0.0366668
+CENTFERM-PWY	0.00776542	0.0139536
+CHLOROPHYLL-SYN	0.0375381	0.00250693
+CITRULBIO-PWY	0.268125	0.028277
+COA-PWY	0.225052	0.0916386
+COA-PWY-1	0.246362	0.0829658
+COBALSYN-PWY	0.0303	0.00178244
+COLANSYN-PWY	0.0302351	0.0034277
+COMPLETE-ARO-PWY	0.240531	0.0289006
+CRNFORCAT-PWY	0.0506292	0.0121435
+DAPLYSINESYN-PWY	0.195661	0.0317622
+DENITRIFICATION-PWY	0.0083252	0.00290447
+DENOVOPURINE2-PWY	0.153298	0.0218334
+DTDPRHAMSYN-PWY	0.351623	0.0510527
+ECASYN-PWY	0.0262674	0.00376655
+ENTBACSYN-PWY	0.034469	0.00996603
+FAO-PWY	0.283098	0.681595
+FASYN-ELONG-PWY	0.509437	0.0906596
+FASYN-INITIAL-PWY	0.323496	0.0613045
+FERMENTATION-PWY	0.081389	0.0146486
+FUCCAT-PWY	0.0258997	0.0114288
+FUC-RHAMCAT-PWY	0.0214779	0.00269629
+GALACTARDEG-PWY	0.0535166	0.00630239
+GALACT-GLUCUROCAT-PWY	0.0246933	0.0029519
+GALACTUROCAT-PWY	0.0384389	0.013608
+GLCMANNANAUT-PWY	0.112131	0.0097333
+GLUCARDEG-PWY	0.0620383	0.00749099
+GLUCARGALACTSUPER-PWY	0.0535166	0.00630239
+GLUCONEO-PWY	0.251989	0.0401254
+GLUCOSE1PMETAB-PWY	0.201837	0.0252353
+GLUCUROCAT-PWY	0.0328287	0.0120152
+GLUDEG-I-PWY	0.0800248	0.051885
+GLUTORN-PWY	0.274208	0.0524521
+GLYCOCAT-PWY	0.0330107	0.00189397
+GLYCOGENSYNTH-PWY	0.126287	0.0497071
+GLYCOL-GLYOXDEG-PWY	0.0732694	0.0106957
+GLYCOLYSIS	0.196687	0.0477873
+GLYCOLYSIS-E-D	0.0315484	0.00558131
+GLYCOLYSIS-TCA-GLYOX-BYPASS	0.0396454	0.00485651
+GLYOXYLATE-BYPASS	0.0885671	0.0524551
+GOLPDLCAT-PWY	0.0434783	0.0148638
+HEME-BIOSYNTHESIS-II	0.3219	0.0975209
+HEMESYN2-PWY	0.336731	0.109504
+HEXITOLDEGSUPER-PWY	0.0397936	0.00830622
+HISDEG-PWY	0.102668	0.0612319
+HISTSYN-PWY	0.109704	0.0300389
+HOMOSER-METSYN-PWY	0.235047	0.0570343
+HSERMETANA-PWY	0.434001	0.124044
+ILEUSYN-PWY	0.548213	0.210067
+KDO-NAGLIPASYN-PWY	0.0123666	0.00293158
+KETOGLUCONMET-PWY	0.0616206	0.00888988
+LACTOSECAT-PWY	0.419374	0.0892027
+LEU-DEG2-PWY	0.0511478	0.0728135
+LPSSYN-PWY	0.0185716	0.00362221
+METHANOGENESIS-PWY	0.0352711	0.00632509
+METHGLYUT-PWY	0.231264	0.0358341
+MET-SAM-PWY	0.165071	0.0322526
+METSYN-PWY	0.185879	0.0402475
+NAD-BIOSYNTHESIS-II	0.0539411	0.0498032
+NAGLIPASYN-PWY	0.0282235	0.00548584
+NONMEVIPP-PWY	0.0366808	0.00468516
+NONOXIPENT-PWY	0.333471	0.119833
+OANTIGEN-PWY	0.064821	0.0115185
+ORNARGDEG-PWY	0.0596968	0.0103622
+ORNDEG-PWY	0.101108	0.0259131
+P105-PWY	0.0587574	0.00991824
+P122-PWY	0.0986031	0.0184304
+P125-PWY	0.478315	0.170173
+P161-PWY	0.229446	0.115246
+P185-PWY	0.25136	0.0335101
+P221-PWY	0.144829	0.0921912
+P241-PWY	0.0254264	0.00454012
+P261-PWY	0.0184375	0.00172471
+P42-PWY	0.265023	0.0654898
+P441-PWY	0.0380878	0.00589089
+P461-PWY	0.151406	0.0393084
+P562-PWY	0.00411946	0.00819304
+PANTO-PWY	0.256329	0.0475521
+PANTOSYN-PWY	0.18209	0.0156617
+PENTOSE-P-PWY	0.205923	0.0327824
+PEPTIDOGLYCANSYN-PWY	0.262078	0.0530054
+PHOSLIPSYN-PWY	0.0375214	0.00488223
+POLYAMSYN-PWY	0.0381404	0.00632617
+POLYISOPRENSYN-PWY	0.286387	0.0868964
+PPGPPMET-PWY	0.233335	0.12058
+PROTOCATECHUATE-ORTHO-CLEAVAGE-PWY	0.00243411	0.0782091
+PWY0-1061	0.156736	0.04166
+PWY0-1241	0.0202085	0.00392304
+PWY0-1261	0.0415094	0.00541882
+PWY0-1296	0.399844	0.0675016
+PWY0-1297	0.191777	0.0357239
+PWY0-1298	0.163573	0.0289767
+PWY0-1319	0.267442	0.0656443
+PWY0-1338	0.0203426	0.00423508
+PWY0-1415	0.185022	0.0203901
+PWY0-1479	0.00637332	0.000828996
+PWY0-1533	0.0380427	0.00285838
+PWY0-1586	0.642168	0.196749
+PWY0-162	0.272231	0.0299502
+PWY0-166	0.0333389	0.00866549
+PWY0-321	0.02807	0.00191978
+PWY0-41	0.022293	0.00457284
+PWY0-42	0.0263233	0.00457259
+PWY0-845	0.0281231	0.00723673
+PWY0-862	0.274273	0.074073
+PWY0-881	0.130657	0.0228336
+PWY-1042	0.546178	0.0910179
+PWY-1269	0.0356984	0.0466622
+PWY-1541	0.0107003	0.00398528
+PWY-181	0.00299148	0.00753257
+PWY-1861	0.193341	0.0236562
+PWY1F-823	0.0326328	0.0163749
+PWY-2941	0.227946	0.0506584
+PWY-2942	0.201976	0.0434436
+PWY-3001	0.431067	0.14867
+PWY-3661	0.0216369	0.00296086
+PWY-3781	1.01665	0.843165
+PWY-3801	0.0800445	0.0099032
+PWY-3841	0.234668	0.0438561
+PWY-3941	0.00804419	0.00163538
+PWY3O-355	0.205026	0.0418821
+PWY-4041	0.0983473	0.0101958
+PWY-4202	0.016321	0.00325086
+PWY-4242	0.161524	0.0226042
+PWY-4321	0.0526335	0.00770928
+PWY-4702	0.0482258	0.00779787
+PWY490-3	0.00130647	0.200701
+PWY-4981	0.282011	0.0412857
+PWY-4984	0.171295	0.024829
+PWY4FS-7	0.0819723	0.0120107
+PWY4FS-8	0.0819723	0.0120107
+PWY4LZ-257	0.150596	0.0469216
+PWY-5005	0.110835	0.0374559
+PWY-5022	0.151743	0.0736761
+PWY-5028	0.00383876	0.00105484
+PWY-5044	0.0521479	0.00482849
+PWY-5067	0.0455141	0.00375252
+PWY-5083	0.12172	0.060874
+PWY-5097	0.203122	0.0597759
+PWY-5100	0.447173	0.114717
+PWY-5101	0.103559	0.0397
+PWY-5103	0.473875	0.148779
+PWY-5104	0.41219	0.0707721
+PWY-5121	0.037774	0.00606188
+PWY-5136	0.259713	0.559791
+PWY-5138	0.176534	0.487365
+PWY-5154	0.0968213	0.0197088
+PWY-5173	0.736598	0.208526
+PWY-5177	0.0081314	0.156677
+PWY-5188	0.224444	0.0615877
+PWY-5189	0.220234	0.0814457
+PWY-5198	0.016533	0.00830795
+PWY-5265	0.263505	0.0417052
+PWY-5345	0.188272	0.0388054
+PWY-5347	0.208183	0.0452868
+PWY-5367	0.00470335	0.00407643
+PWY-5384	0.0694129	0.0127544
+PWY-5484	0.201531	0.048253
+PWY-5505	0.122036	0.104077
+PWY-5531	0.0366897	0.00246808
+PWY-5656	0.0189327	0.00442865
+PWY-5659	0.28852	0.434109
+PWY-5667	0.267442	0.0656443
+PWY-5675	0.0435654	0.109824
+PWY-5676	0.186911	0.143976
+PWY-5686	0.354435	0.0575302
+PWY-5690	0.370623	0.0588303
+PWY-5692	0.02766	0.00401055
+PWY-5695	0.601184	0.462119
+PWY-5705	0.0254948	0.00490674
+PWY-5723	0.133117	0.0159298
+PWY-5747	0.0135783	0.00457259
+PWY-5791	0.168964	0.0222139
+PWY-5837	0.168964	0.0222139
+PWY-5838	0.0300926	0.00455528
+PWY-5840	0.162422	0.0187953
+PWY-5855	0.0817978	0.0152219
+PWY-5856	0.028519	0.00420931
+PWY-5857	0.0817978	0.0152219
+PWY-5861	0.0275695	0.0035595
+PWY-5863	0.179896	0.0239585
+PWY-5897	0.1599	0.0182945
+PWY-5898	0.1599	0.0182945
+PWY-5899	0.1599	0.0182945
+PWY-5910	0.252076	0.039609
+PWY-5913	0.0489618	0.0648256
+PWY-5918	0.196254	0.0240698
+PWY-5920	0.161464	0.0152855
+PWY-5973	0.288863	0.0722322
+PWY-5989	0.250933	0.0530738
+PWY-5994	0.0482267	0.00511879
+PWY-6071	0.025905	0.00177062
+PWY-6121	0.330102	0.131432
+PWY-6122	0.336066	0.147505
+PWY-6123	0.177727	0.0374826
+PWY-6124	0.197165	0.0785672
+PWY-6125	0.182839	0.0190162
+PWY-6126	0.319041	0.0467433
+PWY-6147	0.0160686	0.0260844
+PWY-6151	0.255935	0.0425932
+PWY-6163	0.262483	0.0259363
+PWY-6168	0.144164	0.0339279
+PWY-6185	0.00480651	0.00207427
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_file.txt	Tue Apr 12 02:56:51 2016 -0400
@@ -0,0 +1,6 @@
+statistic	22435
+parameter	parameter
+p.value	2.0527634209064e-29
+null.value	0
+alternative	two.sided
+method	Wilcoxon signed rank test with continuity correction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Tue Apr 12 02:56:51 2016 -0400
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="R" version="3.2.1">
+        <repository changeset_revision="9f31a291b305" name="package_r_3_2_1" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="getopt" version="1.20.0">
+        <repository changeset_revision="a0851e07e3ac" name="package_r_3_2_1_getopt_1_20_0" owner="bebatut" toolshed="https://testtoolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>