diff subset_samples.xml @ 0:03b77eb5ed68 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 7c0ecbffdb5e993f5af7e3b52c424c2761fb91d3"
author iuc
date Mon, 04 Apr 2022 10:25:42 +0000
parents
children 0b0214cbe38b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/subset_samples.xml	Mon Apr 04 10:25:42 2022 +0000
@@ -0,0 +1,112 @@
+<tool id="ampvis2_subset_samples" name="ampvis2 subset samples" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT">
+    <description>by sample metadata</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="header"/>
+    <command detect_errors="exit_code"><![CDATA[
+        Rscript '$rscript'
+    ]]></command>
+    <configfiles>
+        <configfile name="rscript"><![CDATA[
+            library(ampvis2, quietly = TRUE)
+            data <- readRDS("$data")
+            #set vals = 'c("' + '", "'.join(str($vals).split(",")) + '")'
+            data <- amp_subset_samples(
+                data,
+                $invert $var %in% $vals,
+                minreads = $minreads
+                @RAREFY_TOKEN@,
+                normalise = $normalise,
+                removeAbsents = $removeAbsents
+            )
+            saveRDS(data, "$ampvis")
+            @SAVE_METADATA_LIST@
+        ]]></configfile>
+    </configfiles>
+    <inputs>
+        <expand macro="rds_metadata_input_macro"/>
+        <expand macro="metadata_select" an="name" argument="var" optional="false" multiple="false" label="Metadata variable"/>
+        <param name="vals" type="select" optional="false" multiple="true" label="Metadata value(s)">
+            <options from_dataset="metadata_list">
+                <column name="name" index="1"/>
+                <column name="value" index="1"/>
+                <filter type="param_value" ref="var" column="0"/>
+                <filter type="unique_value" column="1"/>
+            </options>
+        </param>
+        <param name="invert" type="boolean" truevalue="!" falsevalue="" checked="false"/>
+        <param argument="minreads" type="integer" value="0" min="0" label="Minimum number of reads" help="Per sample. Samples below this value will be removed initially"/>
+        <expand macro="rarefy_macro" help="This is done initially, but after filtering based on the minreads value, if set."/>
+        <expand macro="normalise_macro"/>
+        <param argument="removeAbsents" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="true"/>
+    </inputs>
+    <outputs>
+        <data name="ampvis" format="ampvis2"/>
+        <data name="metadata_list_out" format="tabular" label="${tool.name} on ${on_string}: metadata list"/>
+    </outputs>
+    <tests>
+        <!-- defaults -->
+        <test expect_num_outputs="2">
+            <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> 
+            <param name="metadata_list" value="AalborgWWTPs-metadata.list"/>
+            <param name="var" value="Plant"/>
+            <param name="vals" value="Aalborg East"/>
+            <output name="ampvis" value="AalborgWWTPs-subset_samples.rds" ftype="ampvis2" compare="sim_size"/>
+            <output name="metadata_list_out" ftype="tabular">
+                <assert_contents>
+                    <has_line line="Plant&#9;Aalborg East&#9;FALSE&#9;character"/>
+                    <not_has_text text="Plant&#9;Aalborg West&#9;FALSE&#9;character"/>
+                    <has_n_lines n="85"/>
+                    <has_n_columns n="4"/>
+                </assert_contents>
+            </output>
+        </test>
+        <!-- invert -->
+        <test expect_num_outputs="2">
+            <param name="data" value="AalborgWWTPs.rds" ftype="ampvis2"/> 
+            <param name="metadata_list" value="AalborgWWTPs-metadata.list"/>
+            <param name="var" value="Plant"/>
+            <param name="vals" value="Aalborg East"/>
+            <param name="invert" value="true"/>
+            <output name="ampvis" value="AalborgWWTPs-subset_samples.rds" ftype="ampvis2" compare="sim_size"/>
+            <output name="metadata_list_out" ftype="tabular">
+                <assert_contents>
+                    <not_has_text text="Plant&#9;Aalborg East&#9;FALSE&#9;character"/>
+                    <has_line line="Plant&#9;Aalborg West&#9;FALSE&#9;character"/>
+                    <has_n_lines n="79"/>
+                    <has_n_columns n="4"/>
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+What it does
+============
+
+Subsets the data in ampvis2 objects based on metadata and returns the subsetted object.
+
+The Galaxy tool calls the `amp_subset_samples
+<https://madsalbertsen.github.io/ampvis2/reference/amp_subset_samples.html>`_ function
+of the ampvis2 package.
+
+The subset is performed on the metadata by ``subset()`` and the abundance- and taxonomy
+tables are then adjusted accordingly.
+
+@HELP_RELATIVE_ABUNDANCES@
+
+Input
+=====
+
+@HELP_RDS_INPUT@
+
+@HELP_METADATA_LIST_INPUT@
+
+Output
+======
+
+An ampvis2_rds dataset containing subsetted data and an updated metadata list dataset.
+
+    ]]></help>
+    <expand macro="citations"/>
+</tool>
\ No newline at end of file