view subset_samples.xml @ 1:14b38ec15fe9 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ampvis2 commit 40ca64669b0f8c875835fcf41ce91e6adb391283"
author iuc
date Thu, 07 Apr 2022 14:08:32 +0000
parents 03b77eb5ed68
children 0b0214cbe38b
line wrap: on
line source

<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>