view confil.xml @ 12:5ec97cccb3fe draft

planemo upload for repository https://github.com/COMBAT-TB/confil commit b1a96c1b50cea70a20d4e606100879da8b6ed1b2
author sanbi-uwc
date Mon, 11 Mar 2019 07:18:34 -0400
parents 72cb19a32d8b
children bbf9ab2ebee7
line wrap: on
line source

<tool id="confil" name="Contamination Filter (confil)" version="@VERSION@+galaxy0">
    <macros>
        <token name="@VERSION@">0.1.4</token>
    </macros>
    <requirements>
        <requirement type="package" version="@VERSION@">confil</requirement>
        <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'

        if confil --threads \${GALAXY_SLOTS:-1} --cutoff $cutoff 
          $input_type_conditional.single_input.element_identifier ;
        then 
          ln -sf "${input_type_conditional.single_input}" '$single_output_file' ;
	    else
	      touch '$single_output_file' ;
	    fi

        ####### 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'

        if confil --threads \${GALAXY_SLOTS:-1} --cutoff $cutoff --paired 
            $input_type_conditional.collection_input.forward.element_identifier $input_type_conditional.collection_input.reverse.element_identifier ;
	    then 
            ln -sf "${input_type_conditional.collection_input.forward}" '$list_output.forward'
            && ln -sf "${input_type_conditional.collection_input.reverse}" '$list_output.reverse' ;
	    else
	        touch '$list_output.forward' && touch '$list_output.reverse' ;
	    fi
        #end if
        && mv $report_name '$output_report'

    ]]>
    </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="90" min="50" max="99" />
    </inputs>
    <outputs>
        <data name="output_report" format="tabular" label="${tool.name} on ${on_string} kraken2 report" />
        <data name="single_output_file" format="fastq" label="${tool.name} on ${on_string} single output">
            <filter>input_type_conditional['input_type'] == "single"</filter>
        </data>
        <collection name="list_output" type="paired" label="${tool.name} on ${on_string} paired output" structured_like="collection_input" inherit_format="true">
            <filter>input_type_conditional['input_type'] == "paired_collection"</filter>
            <data name="forward" format="fastq" />
            <data name="reverse" format="fastq" />
        </collection>
    </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="single_output_file" 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_collection name="list_output" type="paired">
                <element name="forward" value="seq_1.fastq">
                </element>
                <element name="reverse" value="seq_2.fastq">
                </element>
            </output_collection>
        </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>