view confil.xml @ 4:eaf51f9aff10 draft

planemo upload for repository https://github.com/COMBAT-TB/confil commit 9e5284a2616de5d869319f9c4436716a3f6656f8-dirty
author sanbi-uwc
date Mon, 04 Mar 2019 03:28:57 -0500
parents 53a61865e86e
children a7b05dd0087d
line wrap: on
line source

<tool id="confil" name="Contamination Filter (confil)" version="0.1.2">
    <requirements>
        <requirement type="package" version="7.0">click</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        #set $input_type = $input_type_conditional.input_type
        #import re

        ####### Single Input
        #if $input_type == "single"
        ln -s "${input_type_conditional.single_input}" $input_type_conditional.single_input.element_identifier &&
        #set report_name = os.path.splitext(os.path.basename($input_type_conditional.single_input.element_identifier))[0]
        #set report_name = re.sub('_[0-9]+$', '', str(report_name)) + '.tab'

        python $__tool_directory__/confil/confil.py --threads $threads --cutoff $cutoff 
        $input_type_conditional.single_input.element_identifier
        && mv $report_name '$output_report'
        && ln -sf "${input_type_conditional.single_input}" '$output_file1'

        ####### Paired Collection
        #elif $input_type == "paired_collection"
        ln -s "${input_type_conditional.collection_input.forward}" $input_type_conditional.collection_input.forward.element_identifier &&
        ln -s "${input_type_conditional.collection_input.reverse}" $input_type_conditional.collection_input.reverse.element_identifier &&
        #set report_name = os.path.splitext(os.path.basename($input_type_conditional.collection_input.forward.element_identifier))[0]
        #set report_name = re.sub('_[0-9]+$', '', str(report_name)) + '.tab'

        python $__tool_directory__/confil/confil.py --threads $threads --cutoff $cutoff --paired 
        $input_type_conditional.collection_input.forward.element_identifier $input_type_conditional.collection_input.reverse.element_identifier
        && mv $report_name '$output_report'
        && ln -sf "${input_type_conditional.collection_input.forward}" '$output_file1'
        && ln -sf "${input_type_conditional.collection_input.reverse}" '$output_file2'
        #end if
    ]]>
    </command>
    <inputs>
        <conditional name="input_type_conditional">
            <param name="input_type" type="select" label="Select Input Type">
                <option value="single" selected="true">Single Dataset</option>
                <option value="paired_collection">Paired Collection</option>
            </param>
            <when value="single">
                <param name="single_input" type="data" format="fq,fastq,fastq.gz,fastqsanger" label="Select FASTQ Dataset" help="Specify dataset with single reads" />
            </when>
            <when value="paired_collection">
                <param name="collection_input" format="fq,fastq,fastq.gz,fastqsanger" type="data_collection" collection_type="paired" label="Select Dataset Pair" help="Specify paired dataset collection containing paired reads" />
            </when>
        </conditional>
        <param name="cutoff" type="integer" label="Cutoff percentage" value="50" min="50" max="99" />
        <param name="threads" type="integer" label="Number of threads" value="1" min="1" max="4" />
    </inputs>
    <outputs>
        <data name="output_report" format="tabular" label="${tool.name} report" />
        <data name="output_file1" format="fastq" label="${tool.name} report">
        </data>
        <data name="output_file2" format="fastq" label="${tool.name} report">
            <filter>input_type_conditional['input_type'] == "paired_collection"</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="single_input" value="seq_1.fastq" />
            <param name="input_type" value="single" />
            <output name="output_report" ftype="tabular" file="seq.tab" />
            <output name="output_file1" ftype="fastq" file="seq_1.fastq" />
        </test>
        <test>
            <param name="collection_input">
                <collection type="paired">
                    <element name="forward" value="seq_1.fastq" />
                    <element name="reverse" value="seq_2.fastq" />
                </collection>
            </param>
            <param name="input_type" value="paired_collection" />
            <output name="output_report" ftype='tabular' file="seq.tab" />
            <output name="output_file1" ftype='fastq' file="seq_1.fastq" />
            <output name="output_file2" ftype='fastq' file="seq_2.fastq" />
        </test>
    </tests>
    <help><![CDATA[
        confil parses a kraken2 report and determines contamination based on a specified cutoff.
    ]]>    </help>
    <citations>
        <citation type="bibtex">
@misc{githubconfil,
  author = {SANBI-SA},
  year = {2019},
  title = {confil},
  publisher = {GitHub},
  journal = {GitHub repository},
  url = {https://github.com/COMBAT-TB/confil},
}</citation>
    </citations>
</tool>