view extract_element_from_collection.xml @ 0:c46360dcbf3f draft default tip

planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/extract_element_from_collection commit 1c4c58018b64ff3531a719e789ce71cb0a1244c5
author erasmus-medical-center
date Wed, 13 Dec 2017 10:09:11 -0500
parents
children
line wrap: on
line source

<tool id="extract_element_from_collection" name="Extract Element" version="0.1" profile="16.07">
    <description>from a collection based on name</description>
    <command detect_errors="aggressive"><![CDATA[
        echo 'no element with name $elementname found in your collection' > '$output'

        && mkdir elementoutputs
        #for $dataset in $input_collection:
            && echo $dataset.element_identifier
            #if $elementname == ''
                && cp $dataset 'elementoutputs/$dataset.element_identifier'
            #elif $dataset.element_identifier == $elementname:
                && cp $dataset '$output'
            #end if
        #end for
    ]]></command>
    <inputs>
        <param name="input_collection" type="data_collection" collection_type="list" label="Input Collection"/>
        <!-- find a way to make a select from all elements? -->
        <param name="elementname" type="text" value="" label="name of collection element to extract" help="if left blank, all files will be extracted"/>
    </inputs>
    <outputs>
        <data name="output" format="auto" label="${elementname}">
            <filter>elementname != ''</filter>
        </data>
        <data format="auto" name="extracted">
            <discover_datasets pattern="(?P&lt;designation&gt;.+)" directory="elementoutputs" visible="true" assign_primary_output="true"/>
            <filter>elementname == ''</filter>
        </data>
    </outputs>
    <tests>
        <test><!-- test with valid element -->
            <param name="input_collection">
                <collection type="list">
                    <element name="element1" value="example.mothur.shared" />
                    <element name="element2" value="multisample.taxonomy" />
                </collection>
            </param>
            <param name="elementname" value="element2"/>
            <output name="output" file="multisample.taxonomy"/>
        </test>
        <test><!-- test with invalid element -->
            <param name="input_collection">
                <collection type="list">
                    <element name="element1" value="example.mothur.shared" />
                    <element name="element2" value="multisample.taxonomy" />
                </collection>
            </param>
            <param name="elementname" value="element3"/>
            <output name="output">
                <assert_contents>
                    <has_text text="no element with name"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
**What it does**
extract a dataset from a collection based on name
    ]]></help>
    <citations>
    </citations>
</tool>