changeset 0:c58e19ff504a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/vegan/vegan_diversity commit 0e04a4c237677c1f5be1950babcf8591097996a9
author iuc
date Wed, 23 Dec 2015 13:55:10 -0500
parents
children 2c771b437502
files test-data/output_diversity_index.tabular test-data/vegan_in.tabular tool_dependencies.xml vegan_diversity.xml vegan_macros.xml
diffstat 5 files changed, 158 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_diversity_index.tabular	Wed Dec 23 13:55:10 2015 -0500
@@ -0,0 +1,2 @@
+""	"x"
+"1"	1.58148247996845
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/vegan_in.tabular	Wed Dec 23 13:55:10 2015 -0500
@@ -0,0 +1,22 @@
+  3.26	4226	74	P	976	        Bacteroidetes
+  0.01	10	2	P	1090	        Chlorobi
+  0.90	1163	19	P	1239	      Firmicutes
+  0.31	402	12	P	1224	      Proteobacteria
+  0.21	275	0	P	201174	      Actinobacteria
+  0.02	30	14	P	1117	      Cyanobacteria
+  0.01	15	0	P	57723	        Acidobacteria
+  0.01	8	1	P	65842	        Fibrobacteres
+  0.01	12	0	P	200795	      Chloroflexi
+  0.01	8	0	P	142182	      Gemmatimonadetes
+  0.01	8	0	P	200783	      Aquificae
+  0.01	7	0	P	544448	      Tenericutes
+  0.00	6	0	P	203682	      Planctomycetes
+  0.00	5	0	P	40117	      Nitrospirae
+  0.00	5	1	P	74201	        Verrucomicrobia
+  0.00	5	0	P	200918	      Thermotogae
+  0.00	2	0	P	32066	      Fusobacteria
+  0.00	1	0	P	1297	      Deinococcus-Thermus
+  0.00	1	0	P	74152	      Elusimicrobia
+  0.00	1	0	P	200930	      Deferribacteres
+  0.00	1	0	P	203691	      Spirochaetes
+  0.00	1	0	P	28890	      Euryarchaeota
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Wed Dec 23 13:55:10 2015 -0500
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="vegan" version="2.3-0">
+        <repository changeset_revision="1ab514ba46e7" name="package_r_vegan_2_3_0" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="R" version="3.2.1">
+        <repository changeset_revision="d0bf97420fb5" name="package_r_3_2_1" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vegan_diversity.xml	Wed Dec 23 13:55:10 2015 -0500
@@ -0,0 +1,76 @@
+<tool id="vegan_diversity" name="Vegan Diversity" version="0.0.2">
+    <description>
+        index
+    </description>
+    <macros>
+        <import>vegan_macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <expand macro="stdio" />
+    <expand macro="version_command" />
+    <command><![CDATA[
+        Rscript "${vegan_diversity_script}"
+    ]]>
+    </command>
+    <configfiles>
+        <configfile name="vegan_diversity_script"><![CDATA[
+@RSCRIPT_PREAMBLE@
+@RSCRIPT_LOAD_TABULAR_FILE@
+
+write.table( diversity(input_abundance, index = "${index_type.index_type_selector}", MARGIN = ${index_type.margin}, base = ${index_type.base}), "${output_diversity_index}", col.names=NA, sep = "\t")
+    ]]>
+        </configfile>
+    </configfiles>
+    <inputs>
+        <expand macro="params_load_tabular_file" />
+        <conditional name="index_type">
+            <param name="index_type_selector" type="select" label="Diversity index to use">
+                <option value="shannon" selected="True">Shannon or Shannon–Weaver (or Shannon–Wiener)</option>
+                <option value="simpson">Simpson</option>
+                <option value="invsimpson">Inverse Simpson</option>
+            </param>
+            <when value="shannon">
+                <param name="margin" type="integer" value="1" label="Margin for which the index is computed"/>
+                <param name="base" type="select" label="The logarithm base">
+                    <option value="exp(1)" selected="True">Natural Logarithm: exp(1)</option>
+                    <option value="2" selected="False">2</option>
+                </param>
+            </when>
+            <when value="simpson">
+                <param name="margin" type="integer" value="1" label="Margin for which the index is computed"/>
+                <param name="base" type="select" label="The logarithm base">
+                    <option value="exp(1)" selected="True">Natural Logarithm: exp(1)</option>
+                    <option value="2" selected="False">2</option>
+                </param>
+            </when>
+            <when value="invsimpson">
+                <param name="margin" type="integer" value="1" label="Margin for which the index is computed"/>
+                <param name="base" type="select" label="The logarithm base">
+                    <option value="exp(1)" selected="True">Natural Logarithm: exp(1)</option>
+                    <option value="2" selected="False">2</option>
+                </param>
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="tabular" name="output_diversity_index" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input_abundance" ftype="tabular" value="vegan_in.tabular"/>
+            <param name="species_column" value="6"/>
+            <param name="sample_columns" value="2"/>
+            <param name="index_type_selector" value="shannon"/>
+            <param name="margin" value="1"/>
+            <param name="base" value="exp(1)"/>
+            <output name="output_slope" ftype="tabular" file="output_diversity_index.tabular" />
+        </test>
+    </tests>
+    <help>
+        <![CDATA[
+Calculate Diversity index using vegan and selected method.
+        ]]>
+    </help>
+    <citations>
+    </citations>
+</tool>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vegan_macros.xml	Wed Dec 23 13:55:10 2015 -0500
@@ -0,0 +1,49 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="3.2.1">R</requirement>
+            <requirement type="package" version="2.3-0">vegan</requirement>
+            <yield />
+        </requirements>
+    </xml>
+
+    <xml name="version_command">
+        <version_command><![CDATA[Rscript -e 'library(vegan)' 2>&1 > /dev/null | grep 'This is vegan']]></version_command>
+    </xml>
+
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" />
+            <exit_code range=":-1" />
+        </stdio>
+    </xml>
+
+    <xml name="params_load_tabular_file">
+        <param name="input_abundance" type="data" format="tabular" label="File with abundance values for community" help="Rows are samples; columns are species/phyla/community classifier"/>
+        <param name="species_column" label="Group name column" type="data_column" data_ref="input_abundance" value="6" help="Species, phylum, etc"/>
+        <param name="sample_columns" label="Sample count columns" type="data_column" multiple="True" value="2" data_ref="input_abundance" help="Select each column that contains counts"/>
+        <param name="header" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="False" label="Input has a header line"/>
+    </xml>
+
+    <token name="@RSCRIPT_LOAD_TABULAR_FILE@"><![CDATA[
+#set $int_species_column = int( str( $species_column ) )
+#set $fixed_sample_columns = []
+#for $sample_col in map( int, str( $sample_columns ).split( "," ) ):
+#assert $sample_col != $int_species_column, "Sample label column and sample count columns must not be the same."
+#silent $fixed_sample_columns.append( str( $sample_col if $sample_col < $int_species_column else $sample_col-1 ) )
+#end for
+input_abundance <- read.delim("${input_abundance}", header=${header}, sep="\t", row.names=${ species_column })
+input_abundance <- t( input_abundance[ c( ${ ",".join( $fixed_sample_columns ) } )] )
+
+]]>
+    </token>
+
+    <token name="@RSCRIPT_PREAMBLE@"><![CDATA[
+options(bitmapType='cairo')## No X11, so we'll use cairo
+library(vegan)
+]]>
+    </token>
+
+    <token name="@VERSION@">2.3-0</token>
+
+</macros>