changeset 8:77000428c613 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit cb7f20bd60570b9115fb8a9ce793dbe9b3fd65f5
author iuc
date Fri, 01 Nov 2024 17:09:34 +0000
parents c14c7fd4d1be
children bd518ee51da5
files alpha_diversity.xml
diffstat 1 files changed, 42 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/alpha_diversity.xml	Fri Oct 25 14:13:48 2024 +0000
+++ b/alpha_diversity.xml	Fri Nov 01 17:09:34 2024 +0000
@@ -1,4 +1,4 @@
-<tool id="ampvis2_alpha_diversity" name="ampvis2 alpha diversity" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT">
+<tool id="ampvis2_alpha_diversity" name="ampvis2 alpha diversity" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@" license="MIT">
     <description></description>
     <macros>
         <import>macros.xml</import>
@@ -11,13 +11,32 @@
         <configfile name="rscript"><![CDATA[
             #set m='"' + '", "'.join(str($measure).split(",")) + '"'
             library(ampvis2, quietly = TRUE)
+
             d <- readRDS("$data")
-            a <- amp_alphadiv(d,
+            table <- amp_alphadiv(d,
+                measure = c($m),
+                richness = $richness
+                @RAREFY_TOKEN@,
+            )
+            plot <- amp_alphadiv(d,
                 measure = c($m),
                 richness = $richness
-                @RAREFY_TOKEN@
+                @RAREFY_TOKEN@,
+                plot = TRUE,
+                plot_group_by = "$group_by",
+                plot_scatter = $plot_scatter
             )
-            write.table(a, file='$alphadiv', quote=FALSE, sep='\t', row.names=FALSE)
+            write.table(table, file='$alphadiv', quote=FALSE, sep='\t', row.names=FALSE) 
+            ggsave("$alphadiv_plot",
+                    plot = plot,
+                    device = "$output_options.out_format"
+                    #if str($output_options.plot_width) != ''
+                        , width = $output_options.plot_width
+                    #end if
+                    #if str($output_options.plot_height) != ''
+                        , height = $output_options.plot_height
+                    #end if
+                )
         ]]></configfile>
     </configfiles>
     <inputs>
@@ -30,13 +49,19 @@
         </param>
         <param argument="richness" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Calculate sample richness estimates" help="Chao1 and ACE"/>
         <expand macro="rarefy_macro" help="before calculating alpha diversity and/or richnes"/>
+        <param argument="group_by" type="text" label="Group by metadata field (for plotting)" help="Specify the metadata field to group the plot by"/>
+        <param argument="plot_scatter" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Scatter plot instead of boxplot?" help="Select to generate a scatter plot instead of a boxplot"/>
+        <expand macro="out_format_macro"/>
     </inputs>
     <outputs>
         <data name="alphadiv" format="tabular"/>
+        <expand macro="out_macro" name="alphadiv_plot" label=": plot"/>
     </outputs>
     <tests>
         <test>
-            <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> 
+            <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/>
+            <param name="group_by" value="Plant"/>
+            <param name="plot_scatter" value="false"/>
             <output name="alphadiv">
                 <assert_contents>
                     <has_line line="SampleID&#9;Plant&#9;Date&#9;Year&#9;Period&#9;Reads&#9;uniqueOTUs&#9;Shannon&#9;Simpson&#9;invSimpson"/>
@@ -46,12 +71,19 @@
                     <has_n_columns n="10"/>
                 </assert_contents>
             </output>
+            <output name="alphadiv_plot" ftype="pdf">
+                <assert_contents>
+                    <has_size min="1"/>
+                </assert_contents>
+            </output>
         </test>
         <test>
             <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> 
             <param name="measure" value="observed,shannon"/> 
             <param name="richness" value="true"/>
             <param name="rarefy" value="500"/>
+            <param name="group_by" value="Plant"/>
+            <param name="plot_scatter" value="true"/>
             <output name="alphadiv">
                 <assert_contents>
                     <has_line line="SampleID&#9;Plant&#9;Date&#9;Year&#9;Period&#9;RawReads&#9;Reads&#9;uniqueOTUs&#9;Shannon&#9;Simpson&#9;invSimpson&#9;Chao1&#9;ACE"/>
@@ -62,6 +94,11 @@
                     <has_text text="&#9;500&#9;"/>
                 </assert_contents>
             </output>
+            <output name="alphadiv_plot">
+                <assert_contents>
+                    <has_size min="1"/>
+                </assert_contents>
+            </output>
         </test>
     </tests>
     <help><![CDATA[