view waveica.xml @ 10:821062fc5782 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/waveica commit 2b8b1dcb2947c6503fd4f82904df708e4f88ea1d
author recetox
date Fri, 04 Jul 2025 09:43:22 +0000
parents 6fc9f6dbcef5
children
line wrap: on
line source

<tool id="waveica" name="WaveICA" version="@TOOL_VERSION@+galaxy10" profile="23.0">
    <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>
        <requirement type="package" version="1.0.10">r-dplyr</requirement>
    </requirements>
    <command detect_errors="aggressive"><![CDATA[
        Rscript -e "source('${__tool_directory__}/waveica_wrapper.R');
        normalized_data <-
        #if $batch_correction.mode == 'batchwise':
            waveica(
                data_matrix_file = '$data_matrix',
                sample_metadata_file = '$sample_metadata',
                ft_ext = '$data_matrix.ext',
                mt_ext = '$sample_metadata.ext',
                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,
                transpose = $transpose_feature_table
            )
        #else:
            waveica_singlebatch(
                data_matrix_file = '$data_matrix',
                sample_metadata_file = '$sample_metadata',
                ft_ext = '$data_matrix.ext',
                mt_ext = '$sample_metadata.ext',
                wavelet_filter = '$wf.wavelet_filter',
                wavelet_length = '$wf.wavelet_length',
                k = $k,
                alpha = $alpha,
                cutoff = $batch_correction.cutoff,
                exclude_blanks = $exclude_blanks
                transpose = $transpose_feature_table
            )
        #end if
        ;store_data(normalized_data, '$normalized_data', '$data_matrix.ext')"
    ]]></command>

    <inputs>
        <param name="data_matrix" type="data" label="Feature table" format="csv,tsv,tabular,parquet" help="Table of measured features for each sample."/>
        <param name="sample_metadata" label="Input sample metadata" type="data" format="csv,tsv,tabular,parquet" help="Table with sample information (e.g., sample name, class, batch, injection order) for each sample." />
         <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)." />
        <param type="integer" value="20" name="k" label="Number of components to decompose" help="maximal component that ICA decomposes"/>
        <param type="float" value="0" name="alpha" label="Alpha" help="trade-off value between the independence of samples (temporal ICA) and variables (spatial ICA), should be between 0 and 1"/>
        <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">
                <param type="float" value="0.05" name="t" label="Batch-association threshold" help="threshold to consider a component associate with the batch, should be between 0 and 1"/>
                <param type="float" value="0.05" name="t2" label="Group-association threshold" help="threshold to consider a component associate with the group, should be between 0 and 1"/>
            </when>
            <when value="single_batch">
                <param type="float" value="0" name="cutoff" label="Cutoff" help="threshold of the variation explained by the injection order for independent components, should be between 0 and 1"/>
            </when>
        </conditional>
        <param name="exclude_blanks" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Remove blanks" help="Excludes blank samples from the output" />
    </inputs>

    <expand macro="outputs"/>

    <tests>
        <test><!-- TEST 1: CSV input -->
            <param name="data_matrix" value="data_matrix.csv" ftype="csv"/>
            <param name="sample_metadata" value="sample_metadata.csv" ftype="csv"/>
            <param name="alpha" value="0"/>
            <param name="k" value="20"/>
            <conditional name="wf">
                <param name="wavelet_filter" value="d"/>
                <param name="wavelet_length" value="2"/>
            </conditional>
            <conditional name="batch_correction">
                <param name="mode" value="batchwise"/>
                <param name="t" value="0.05"/>
                <param name="t2" value="0.05"/>
            </conditional>
            <output name="normalized_data" file="test1_output.csv" ftype="csv"/>
        </test>
        <test><!-- TEST 2: TSV input -->
            <param name="data_matrix" value="data_matrix.tsv" ftype="tabular"/>
            <param name="sample_metadata" value="sample_metadata.tsv" ftype="tabular"/>
            <param name="alpha" value="0"/>
            <param name="k" value="20"/>
            <conditional name="wf">
                <param name="wavelet_filter" value="d"/>
                <param name="wavelet_length" value="2"/>
            </conditional>
            <conditional name="batch_correction">
                <param name="mode" value="batchwise"/>
                <param name="t" value="0.05"/>
                <param name="t2" value="0.05"/>
            </conditional>
            <output name="normalized_data" file="normalized_data.tsv" ftype="tabular"/>
        </test>
        <test><!-- TEST 3: Parquet input -->
            <param name="data_matrix" value="data_matrix.parquet" ftype="parquet"/>
            <param name="sample_metadata" value="sample_metadata.csv" ftype="csv"/>
            <param name="alpha" value="0"/>
            <param name="k" value="20"/>
            <conditional name="wf">
                <param name="wavelet_filter" value="d"/>
                <param name="wavelet_length" value="2"/>
            </conditional>
            <conditional name="batch_correction">
                <param name="mode" value="batchwise"/>
                <param name="t" value="0.05"/>
                <param name="t2" value="0.05"/>
            </conditional>
            <output name="normalized_data" file="test3_output.parquet" compare="sim_size" delta="200" ftype="parquet"/>
        </test>
        <test expect_failure="true"><!-- TEST 4: NA data should fail -->
            <param name="data_matrix" value="na_data.csv" ftype="csv"/>
            <param name="sample_metadata" value="sample_metadata.csv" ftype="csv"/>
        </test>
        <test expect_failure="true"><!-- TEST 5: Incomplete metadata should fail -->
            <param name="data_matrix" value="data_matrix.csv" ftype="csv"/>
            <param name="sample_metadata" value="incomplete_metadata_data.csv" ftype="csv"/>
        </test>

        <test><!-- TEST 6 -->
            <param name="data_matrix" value="feature_table_transpose_version.parquet" ftype="parquet"/>
            <param name="sample_metadata" value="sample_metadata.parquet" ftype="parquet"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <output name="normalized_data" file="normalized_data.parquet" compare="sim_size" delta="200" ftype="parquet"/>
        </test>
        <test><!-- TEST 7 -->
            <param name="data_matrix" value="feature_table_transpose_version.csv" ftype="csv"/>
            <param name="sample_metadata" value="sample_metadata.csv" ftype="csv"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <output name="normalized_data" file="normalized_data.csv" ftype="csv"/>
        </test>
        <test><!-- TEST 8 -->
            <param name="data_matrix" value="feature_table_transpose_version.parquet" ftype="parquet"/>
            <param name="sample_metadata" value="sample_metadata.parquet" ftype="parquet"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <output name="normalized_data" file="test9_output1.parquet" ftype="parquet"/>
        </test>
        <test><!-- TEST 9 -->
            <param name="data_matrix" value="feature_table_transpose_version.csv" ftype="csv"/>
            <param name="sample_metadata" value="sample_metadata.csv" ftype="csv"/>
            <param name="transpose_feature_table" value="TRUE"/>
            <output name="normalized_data" file="test10_output1.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>