view waveica.xml @ 4:425c0494ec2d draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 84de3bc96ad2859d87c70ba94d8ceb0b2bc2a0da
author recetox
date Tue, 07 May 2024 12:49:20 +0000
parents dbbedb14b44c
children e424fa636281
line wrap: on
line source

<tool id="waveica" name="WaveICA" version="@TOOL_VERSION@+galaxy5" profile="21.09">
    <description>removal of batch effects for untargeted metabolomics data</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="annotation"/>
    <expand macro="creator"/>

    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">r-recetox-waveica</requirement>
        <requirement type="package" version="8.0.0">r-arrow</requirement>
    </requirements>
    <command detect_errors="aggressive"><![CDATA[
        Rscript
            -e 'source("${__tool_directory__}/waveica_wrapper.R")'

            #if $batch_correction.mode == "batchwise":
            -e 'normalized_data <- waveica(
                file = "$input_num.data",
                #if $input_num.input_choice == "2":
                    metadata = "$input_num.input_metadata.metadata",
                    ext = "$input_num.data.ext,$input_num.input_metadata.metadata.ext",
                    transpose = $input_num.transpose_feature_table,
                #else:
                    ext = "$input_num.data.ext",
                #end if
                wavelet_filter = "$wf.wavelet_filter",
                wavelet_length = "$wf.wavelet_length",
                k = $k,
                t = $batch_correction.t,
                t2 = $batch_correction.t2,
                alpha = $alpha,
                exclude_blanks = $exclude_blanks
            )'
            #else if $batch_correction.mode == "single_batch":
            -e 'normalized_data <- waveica_singlebatch( 
                file = "$input_num.data",
                #if $input_num.input_choice == "2":
                    metadata = "$input_num.input_metadata.metadata",
                    ext = "$input_num.data.ext,$input_num.input_metadata.metadata.ext",
                    transpose = $input_num.transpose_feature_table,
                #else:
                    ext = "$input_num.data.ext",
                #end if
                wavelet_filter = "$wf.wavelet_filter",
                wavelet_length = "$wf.wavelet_length",
                k = $k,
                alpha = $alpha,
                cutoff = $batch_correction.cutoff,
                exclude_blanks = $exclude_blanks
            )'
            #end if

            -e 'store_data(normalized_data, "$normalized_data", "$input_num.data.ext")'
    ]]></command>

    <inputs>
        <conditional name="input_num">
            <param name="input_choice" type="select" label="Choose input files:">
                    <option value="1" selected="true">1</option>
                    <option value="2">2</option>
            </param>
            <when value="1">
                <expand macro="input_data"/>
            </when>
            <when value="2">
                <expand macro="input_data"/>
                <section name="input_metadata" title="Input metadata table" expanded="true">
                    <param name="metadata" label="Input metadata" type="data" format="csv,tsv,parquet" help="" />
                </section>
                <param name = "transpose_feature_table" label="Transpose feature table" type="boolean" checked="false" 
                truevalue="TRUE" falsevalue="FALSE" help="Swap sample names with feature names as column headers (to fit recetox-aplcms outputs)." />
            </when>
        </conditional>
        <expand macro="general_parameters"/>
        <expand macro="wf"/>
        <conditional name="batch_correction">
            <param name="mode" type="select" label="Batch correction mode" help="'multiple batches' takes into account
            inter- and intrabatch intensity drift; 'single batch' relies only on the injection order of the samples and
            requires no batch information [2]">
                <option value="batchwise" selected="true">Multiple batches</option>
                <option value="single_batch">Single batch (or no batch information)</option>
            </param>
            <when value="batchwise">
                <expand macro="batchwise_parameters"/>
            </when>
            <when value="single_batch">
                <expand macro="singlebatch_parameters"/>
            </when>
        </conditional>
        <expand macro="exclude_blanks"/>
    </inputs>

    <expand macro="outputs"/>

    <tests>
        <test><!-- TEST 1 -->
            <param name="data" value="input_data.csv" ftype="csv"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
        </test>
        <test><!-- TEST 2 -->
            <param name="data" value="input_data.tsv" ftype="tsv"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
        </test>
        <test><!-- TEST 3 -->
            <param name="data" value="input_data.parquet" ftype="parquet"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.parquet" ftype="parquet"/>
        </test>
        <test><!-- TEST 4 -->
            <param name="input_choice" value="2"/>
            <param name="data" value="feature_table.csv" ftype="csv"/>
            <param name="metadata" value="metadata.csv" ftype="csv"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
        </test>
        <test><!-- TEST 5 -->
            <param name="input_choice" value="2"/>
            <param name="data" value="feature_table.tsv" ftype="tsv"/>
            <param name="metadata" value="metadata.tsv" ftype="tsv"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
        </test>
        <test><!-- TEST 6 -->
            <param name="input_choice" value="2"/>
            <param name="data" value="feature_table.parquet" ftype="parquet"/>
            <param name="metadata" value="metadata.csv" ftype="csv"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200" ftype="parquet"/>
        </test>
        <test><!-- TEST 7 -->
            <param name="input_choice" value="2"/>
            <param name="data" value="feature_table_transpose_version.parquet" ftype="parquet"/>
            <param name="metadata" value="metadata.parquet" ftype="parquet"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200" ftype="parquet"/>
        </test>
        <test><!-- TEST 8 -->
            <param name="input_choice" value="2"/>
            <param name="data" value="feature_table_transpose_version.csv" ftype="csv"/>
            <param name="metadata" value="metadata.csv" ftype="csv"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <param name="mode" value="batchwise"/>
            <param name="wavelet_filter" value="d"/>
            <param name="wavelet_length" value="2"/>
            <param name="k" value="20"/>
            <param name="t" value="0.05"/>
            <param name="t2" value="0.05"/>
            <param name="alpha" value="0"/>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tsv"/>
        </test>
        <!-- The following test has different results on three platform I've tried -->
        <!-- <test>
            <param name="data" value="input_data_nobatch.csv" ftype="csv"/>
            <param name="mode" value="single_batch"/>
            <param name="wavelet_filter" value="d"/>
            <param name="filter_length" value="2"/>
            <param name="k" value="20"/>
            <param name="alpha" value="0"/>
            <param name="cutoff" value="0"/>
            <output name="normalized_data" file="normalized_data_nobatch.tsv"/>
        </test> -->
        <test expect_failure="true">
            <param name="data" value="na_data.csv" ftype="csv"/>
        </test>
        <test expect_failure="true">
            <param name="data" value="incomplete_metadata_data.csv" ftype="csv"/>
        </test>
    </tests>

    <help>
        <![CDATA[
        @HELP@
        ]]>
    </help>

    <citations>
        <citation type="doi">10.1016/j.aca.2019.02.010</citation>
        <citation type="doi">10.1007/s11306-021-01839-7</citation>
    </citations>

</tool>