view cami_amber_convert_to_biobox.xml @ 2:848594e0be6a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/amber/ commit 3d970dee40d339c0af6eda9e5a9bb39140bbc9cd
author iuc
date Fri, 30 Aug 2024 14:38:48 +0000
parents 8754ed6f0096
children
line wrap: on
line source

<tool id="cami_amber_convert" name="CAMI AMBER convert to biobox" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Create binning file(s) for CAMI AMBER</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code">
    <![CDATA[

    mkdir -p output 

    #for $file in $input.files:
        &&
        ln -s '$file' './$file.element_identifier' 
    #end for

    #if $work == "single":
        #for $file in $input.files:
            &&
            #set $out = $file.element_identifier.split('.')[0] + '.tsv'
            convert_fasta_bins_to_biobox_format.py
            -o 'output/$out'
            '$file.element_identifier'
        #end for
    #else:
        &&
        convert_fasta_bins_to_biobox_format.py
        -o 'output/binning.tsv'
        #for $file in $input.files:
            '$file.element_identifier'
        #end for
    #end if

    ]]>
    </command>
    <inputs>
        <param name="work" type="select" label="Merge binning output files?"
            help="If yes all input files will be merged into one biobox output (required input by amber). If no each input will be converted into a separate biobox output file." >
            <option value="single">Each file alone</option>
            <option value="all">All together</option>
        </param>
        <conditional name="input">
            <param name="is_select" type="select" label="Choose how to input the files"
                help="You can provide each input separately or as a collection">
                <option value="manually">Manually</option>
                <option value="data">Data collection</option>
            </param>
            <when value="manually">
                <param name="files" type="data" format="fasta" multiple="true"
                    label="Input fasta files"
                    help="Input all fasta files which this tool should convert into biobox format" />
            </when>
            <when value="data">
                <param name="files" type="data_collection" collection_type="list" format="fasta"
                    label="Input the fasta collection"
                    help="Input the fasta collected which the tool should convert into biobox format" />
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="binning_file" format="tabular" from_work_dir="output/binning.tsv" label="${tool.name}: BINNING FILE">
            <filter>work and "all" in work</filter>
        </data>
        <collection name="binning_collection" type="list" label="${tool.name}: BINNING COLLECTION" >
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.tsv" format="tabular" directory="output/" recurse="true" />
            <filter>work and "single" in work</filter>
        </collection>
    </outputs>
    <tests>
        <test expect_num_outputs="1" >
            <param name="work" value="single" />
            <conditional name="input" >
                <param name="is_select" value="manually" />
                <param name="files" value="test_add1.fasta,test_add2.fasta" ftype="fasta" />
            </conditional>
            <output_collection name="binning_collection" type="list">
                <element name="test_add1" >
                    <assert_contents>
                        <has_n_lines n="1464" />
                    </assert_contents>
                </element>
                <element name="test_add2" >
                    <assert_contents>
                        <has_n_lines n="36" />
                    </assert_contents>
                </element>
            </output_collection>
        </test>
        <test expect_num_outputs="1" >
            <param name="work" value="single" />
            <conditional name="input" >
                <param name="is_select" value="data" />
                <param name="files" >
                    <collection name="test" type="list" >
                        <element name="test_add1" value="test_add1.fasta" />
                        <element name="test_add2" value="test_add2.fasta" />
                    </collection>
                </param>
            </conditional>
            <output_collection name="binning_collection" type="list">
                <element name="test_add1" >
                    <assert_contents>
                        <has_n_lines n="1464" />
                    </assert_contents>
                </element>
                <element name="test_add2" >
                    <assert_contents>
                        <has_n_lines n="36" />
                    </assert_contents>
                </element>
            </output_collection>
        </test>
        <test expect_num_outputs="1" >
            <param name="work" value="all" />
            <conditional name="input" >
                <param name="is_select" value="manually" />
                <param name="files" value="test_add1.fasta,test_add2.fasta" ftype="fasta" />
            </conditional>
            <output name="binning_file">
                <assert_contents>
                    <has_n_lines n="1496" />
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1" >
            <param name="work" value="all" />
            <conditional name="input" >
                <param name="is_select" value="data" />
                <param name="files" >
                    <collection name="test" type="list" >
                        <element name="test_add1" value="test_add1.fasta" />
                        <element name="test_add2" value="test_add2.fasta" />
                    </collection>
                </param>
            </conditional>
            <output name="binning_file">
                <assert_contents>
                    <has_n_lines n="1496" />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help>
    <![CDATA[
        .. class:: infomark

        **What it does**

        This tool can create a tsv file in biobox format or a collection of multiple files.

        **Input**

        This tool required only fasta files. You can submit n files manually or a collection of fasta files.

        **Output**

        This tool either give out 1 binning file in biobox format or for each inputted file 1 binning file in biobox format.

    ]]>
    </help>
    <expand macro="citations" />
</tool>