view prinseq.xml @ 4:654b3a274ed5 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/prinseq/ commit 9cd78488b53cde8d3139d2d71ec500e2c91b9335"
author iuc
date Wed, 07 Jul 2021 09:22:27 +0000
parents 02befcb391f5
children 1ee282794de3
line wrap: on
line source

<tool id="prinseq" name="PRINSEQ" version="@TOOL_VERSION+galaxy1">
    <description>to process quality of sequences</description>
    <macros>
        <token name="@TOOL_VERSION">0.20.4</token>
    </macros>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION">prinseq</requirement>
    </requirements>

    <stdio>
        <exit_code range="1:"   level="fatal"   description="" />
        <regex match="ERROR"
               source="stderr"
               level="fatal"
               description="" />
        <regex match="WARNING"
               source="stderr"
               level="warning"
               description="" />
    </stdio>

    <version_command>
<![CDATA[
    prinseq-lite.pl --version
]]>
    </version_command>

    <command>
<![CDATA[
        mkdir tmp/

        &&

        prinseq-lite.pl
            #if $seq_type.seq_type_opt == "single":
                -fastq '$seq_type.input_singles'
                #if $seq_type.input_singles.is_of_type('fastqillumina'):
                    -phred64
                #end if
            #elif $seq_type.seq_type_opt == "paired":
                -fastq '$seq_type.input_mate1'
                -fastq2 '$seq_type.input_mate2'
                #if $seq_type.input_mate1.ext != $seq_type.input_mate2.ext:
                    #import sys
                    #silent sys.stderr.write( 'Both pairs from your paired-end library need to be from the same filetype.' )
                #end if
                #if $seq_type.input_mate1.is_of_type('fastqillumina'):
                    -phred64
                #end if
            #else 
                -fastq '$seq_type.input_collection.forward'
                -fastq2 '$seq_type.input_collection.reverse'
                #if $seq_type.input_collection.forward.is_of_type('fastqillumina'):
                    -phred64
                #end if
            #end if

            -out_good "tmp/good_sequences"
            -out_bad "tmp/rejected_sequences"

            #if $filter_treatments.apply_filter_treatments == "true":
                #set length_filter_treatments=$filter_treatments.length_filter_treatments
                #if $length_filter_treatments.apply_length_filter_treatments == "true":
                    #set min_length_filter_treatments=$length_filter_treatments.min_length_filter_treatments
                    #if $min_length_filter_treatments.apply_min_length_filter_treatments == "true":
                        -min_len $min_length_filter_treatments.min_length_filter_treatment_value
                    #end if

                    #set max_length_filter_treatments=$length_filter_treatments.max_length_filter_treatments
                    #if $max_length_filter_treatments.apply_max_length_filter_treatments == "true":
                        -max_len $max_length_filter_treatments.max_length_filter_treatment_value
                    #end if
                #end if

                #set quality_filter_treatments=$filter_treatments.quality_filter_treatments
                #if $quality_filter_treatments.apply_quality_filter_treatments == "true":
                    #set min_quality_filter_treatments=$quality_filter_treatments.min_quality_filter_treatments
                    #if $min_quality_filter_treatments.apply_min_quality_filter_treatments == "true":
                        -min_qual_score $min_quality_filter_treatments.min_quality_filter_treatment_value
                    #end if

                    #set max_quality_filter_treatments=$quality_filter_treatments.max_quality_filter_treatments
                    #if $max_quality_filter_treatments.apply_max_quality_filter_treatments == "true":
                        -max_qual_score $max_quality_filter_treatments.max_quality_filter_treatment_value
                    #end if

                    #set mean_quality_filter_treatments=$quality_filter_treatments.mean_quality_filter_treatments
                    #if $mean_quality_filter_treatments.apply_mean_quality_filter_treatments == "true":
                        #set min_mean_quality_filter_treatments=$mean_quality_filter_treatments.min_mean_quality_filter_treatments
                        #if $min_mean_quality_filter_treatments.apply_min_mean_quality_filter_treatments == "true":
                            -min_qual_mean $min_mean_quality_filter_treatments.min_mean_quality_filter_treatment_value
                        #end if

                        #set max_mean_quality_filter_treatments=$mean_quality_filter_treatments.max_mean_quality_filter_treatments
                        #if $max_mean_quality_filter_treatments.apply_max_mean_quality_filter_treatments == "true":
                            -max_qual_mean $max_mean_quality_filter_treatments.max_mean_quality_filter_treatment_value
                        #end if
                    #end if
                #end if

                #set base_content_filter_treatments=$filter_treatments.base_content_filter_treatments
                #if $base_content_filter_treatments.apply_base_content_filter_treatments == "true":
                    #set GC_perc_content_filter_treatments=$base_content_filter_treatments.GC_perc_content_filter_treatments
                    #if $GC_perc_content_filter_treatments.apply_GC_perc_content_filter_treatments == "true":
                        #set min_GC_perc_content_filter_treatments=$GC_perc_content_filter_treatments.min_GC_perc_content_filter_treatments
                        #if $min_GC_perc_content_filter_treatments.apply_min_GC_perc_content_filter_treatments == "true":
                            -min_gc $min_GC_perc_content_filter_treatments.min_GC_perc_content_filter_treatment_value
                        #end if

                        #set max_GC_perc_content_filter_treatments=$GC_perc_content_filter_treatments.max_GC_perc_content_filter_treatments
                        #if $max_GC_perc_content_filter_treatments.apply_max_GC_perc_content_filter_treatments == "true":
                            -max_gc $max_GC_perc_content_filter_treatments.max_GC_perc_content_filter_treatment_value
                        #end if
                    #end if

                    #set N_number_content_filter_treatments=$base_content_filter_treatments.N_number_content_filter_treatments
                    #if $N_number_content_filter_treatments.apply_N_number_content_filter_treatments == "true":
                        -ns_max_n $N_number_content_filter_treatments.N_number_content_filter_treatment_value
                    #end if

                    #set N_percentage_content_filter_treatments=$base_content_filter_treatments.N_percentage_content_filter_treatments
                    #if $N_percentage_content_filter_treatments.apply_N_percentage_content_filter_treatments == "true":
                        -ns_max_p $N_percentage_content_filter_treatments.N_percentage_content_filter_treatment_value
                    #end if

                    $base_content_filter_treatments.apply_other_base_content_filter_treatments
                #end if

                #set complexity_filter_treatments=$filter_treatments.complexity_filter_treatments
                #if $complexity_filter_treatments.apply_complexity_filter_treatments == "true":
                    -lc_method $complexity_filter_treatments.method_complexity_filter_treatments
                    -lc_threshold $complexity_filter_treatments.threshold_complexity_filter_treatments
                #end if

            #end if

            #if $trimming_treatments.apply_trimming_treatments == "true":
                #set length_trimming_treatments=$trimming_treatments.length_trimming_treatments
                #if $length_trimming_treatments.apply_length_trimming_treatments == "true":
                    -trim_to_len $length_trimming_treatments.length_trimming_treatment_value
                #end if

                #set position_trimming_treatments=$trimming_treatments.position_trimming_treatments
                #if $position_trimming_treatments.apply_position_trimming_treatments == "true":
                    #set nb_position_trimming_treatments=$position_trimming_treatments.nb_position_trimming_treatments
                    #if $nb_position_trimming_treatments.apply_nb_position_trimming_treatments == "true":
                        #set left_position_trimming_treatments=$nb_position_trimming_treatments.left_position_trimming_treatments
                        #if $left_position_trimming_treatments.apply_left_position_trimming_treatments == "true":
                            -trim_left $left_position_trimming_treatments.left_position_trimming_treatment_value
                        #end if

                        #set right_position_trimming_treatments=$nb_position_trimming_treatments.right_position_trimming_treatments
                        #if $right_position_trimming_treatments.apply_right_position_trimming_treatments == "true":
                            -trim_right $right_position_trimming_treatments.right_position_trimming_treatment_value
                        #end if
                    #end if

                    #set percentage_position_trimming_treatments=$position_trimming_treatments.percentage_position_trimming_treatments
                    #if $percentage_position_trimming_treatments.apply_percentage_position_trimming_treatments == "true":
                        #set left_percentage_position_trimming_treatments=$percentage_position_trimming_treatments.left_percentage_position_trimming_treatments
                        #if $left_percentage_position_trimming_treatments.apply_left_percentage_position_trimming_treatments == "true":
                            -trim_left_p $left_percentage_position_trimming_treatments.left_percentage_position_trimming_treatment_value
                        #end if

                        #set right_percentage_position_trimming_treatments=$percentage_position_trimming_treatments.right_percentage_position_trimming_treatments
                        #if $right_percentage_position_trimming_treatments.apply_right_percentage_position_trimming_treatments == "true":
                            -trim_right_p $right_percentage_position_trimming_treatments.right_percentage_position_trimming_treatment_value
                        #end if
                    #end if
                #end if

                #set tail_trimming_treatments=$trimming_treatments.tail_trimming_treatments
                #if $tail_trimming_treatments.apply_tail_trimming_treatments == "true":
                    #set a_t_tail_trimming_treatments=$tail_trimming_treatments.a_t_tail_trimming_treatments
                    #if $a_t_tail_trimming_treatments.apply_a_t_tail_trimming_treatments == "true":
                        #set left_a_t_tail_trimming_treatments=$a_t_tail_trimming_treatments.left_a_t_tail_trimming_treatments
                        #if $left_a_t_tail_trimming_treatments.apply_left_a_t_tail_trimming_treatments == "true":
                            -trim_tail_left $left_a_t_tail_trimming_treatments.left_a_t_tail_trimming_treatment_value
                        #end if

                        #set right_a_t_tail_trimming_treatments=$a_t_tail_trimming_treatments.right_a_t_tail_trimming_treatments
                        #if $right_a_t_tail_trimming_treatments.apply_right_a_t_tail_trimming_treatments == "true":
                            -trim_tail_right $right_a_t_tail_trimming_treatments.right_a_t_tail_trimming_treatment_value
                        #end if
                    #end if

                    #set ns_tail_trimming_treatments=$tail_trimming_treatments.ns_tail_trimming_treatments
                    #if $ns_tail_trimming_treatments.apply_ns_tail_trimming_treatments == "true":
                        #set left_ns_tail_trimming_treatments=$ns_tail_trimming_treatments.left_ns_tail_trimming_treatments
                        #if $left_ns_tail_trimming_treatments.apply_left_ns_tail_trimming_treatments == "true":
                            -trim_ns_left $left_ns_tail_trimming_treatments.left_ns_tail_trimming_treatment_value
                        #end if

                        #set right_ns_tail_trimming_treatments=$ns_tail_trimming_treatments.right_ns_tail_trimming_treatments
                        #if $right_ns_tail_trimming_treatments.apply_right_ns_tail_trimming_treatments == "true":
                            -trim_ns_right $right_ns_tail_trimming_treatments.right_ns_tail_trimming_treatment_value
                        #end if
                    #end if
                #end if

                #set quality_trimming_treatments=$trimming_treatments.quality_trimming_treatments
                #if $quality_trimming_treatments.apply_quality_trimming_treatments == "true":
                    #set left_quality_trimming_treatments=$quality_trimming_treatments.left_quality_trimming_treatments
                    #if $left_quality_trimming_treatments.apply_left_quality_trimming_treatments == "true":
                        -trim_qual_left $left_quality_trimming_treatments.left_quality_trimming_treatment_value
                    #end if

                    #set right_quality_trimming_treatments=$quality_trimming_treatments.right_quality_trimming_treatments
                    #if $right_quality_trimming_treatments.apply_right_quality_trimming_treatments == "true":
                        -trim_qual_right $right_quality_trimming_treatments.right_quality_trimming_treatment_value
                    #end if

                    -trim_qual_type $quality_trimming_treatments.type_quality_trimming_treatments
                    -trim_qual_rule $quality_trimming_treatments.rule_quality_trimming_treatments
                    -trim_qual_window $quality_trimming_treatments.window_quality_trimming_treatments
                    -trim_qual_step $quality_trimming_treatments.step_quality_trimming_treatments
                #end if

            #end if

            #*
            -graph_stats "$graph_stats"
            -graph_data tmp/stats.gd

        &&

        prinseq-graphs-noPCA.pl -i "tmp/stats.gd" -html_all -o stats_html
        *#
]]>
    </command>

    <inputs>
        <conditional name="seq_type">
            <param name="seq_type_opt" type="select" label="Is this library paired- or single-end?">
              <option value="single" selected="true">Single-end</option>
              <option value="paired">Paired-end</option>
              <option value="paired_collection">Paired Collection</option>
            </param>
            <when value="single">
                <param name="input_singles" type="data" format="fastqsanger,fastqillumina,fastq" label="FASTQ file" help="FASTQ files." />
            </when>
            <when value="paired">
                <param name="input_mate1" type="data" format="fastqsanger,fastqillumina,fastq" label="FASTQ file" help="FASTQ files." />
                <param name="input_mate2" type="data" format="fastqsanger,fastqillumina,fastq" label="FASTQ file" help="FASTQ files." />
            </when>
            <when value="paired_collection">
                <param name="input_collection" type="data_collection" collection_type="paired" label="FASTQ collection" help="FASTQ data in a paired collection" />
            </when>
        </conditional>

        <conditional name="filter_treatments">
            <param name="apply_filter_treatments" type="select" label="Apply filter treatments?">
              <option value="true" selected="true">Yes</option>
              <option value="false">No</option>
            </param>
            <when value="true">
                <conditional name="length_filter_treatments">
                    <param name="apply_length_filter_treatments" type="select" label="Filter sequence based on their length?" help="By default, sequences smaller than 60 bp are removed. No top threshold is defined">
                      <option value="true" selected="true">Yes</option>
                      <option value="false">No</option>
                    </param>
                    <when value="true">
                        <conditional name="min_length_filter_treatments">
                            <param name="apply_min_length_filter_treatments" type="select" label="Filter too small sequences?" help="By default, sequences smaller than 60 bp are removed.">
                              <option value="true" selected="true">Yes</option>
                              <option value="false">No</option>
                            </param>
                            <when value="true">
                                <param name="min_length_filter_treatment_value" type="integer" min="0" max="3000" value="60" label="Minimum length threshold to conserve sequences" help="(-min_len)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="max_length_filter_treatments">
                            <param name="apply_max_length_filter_treatments" type="select" label="Filter too big sequences?" help="By default, no treatment based on a maximal length is made.">
                              <option value="true">Yes</option>
                              <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <param name="max_length_filter_treatment_value" type="integer" min="0" max="3000" value="1000" label="Maximal length threshold to conserve sequences" help="(-max_len)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="quality_filter_treatments">
                    <param name="apply_quality_filter_treatments" type="select" label="Filter sequences based on quality score?" help="By default, sequences with a mean score below 15 are removed.">
                      <option value="true" selected="true">Yes</option>
                      <option value="false">No</option>
                    </param>
                    <when value="true">
                        <conditional name="min_quality_filter_treatments">
                            <param name="apply_min_quality_filter_treatments" type="select" label="Filter sequences based on their minimum score?" help="By default, no treatment based on a minimum score is made.">
                              <option value="true">Yes</option>
                              <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <param name="min_quality_filter_treatment_value" type="integer" min="0" max="40" value="2" label="Minimum score threshold to conserve sequences" help="(-min_qual_score)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="max_quality_filter_treatments">
                            <param name="apply_max_quality_filter_treatments" type="select" label="Filter sequences based on their maximum score?" help="By default, no treatment based on a minimum score is made.">
                              <option value="true">Yes</option>
                              <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <param name="max_quality_filter_treatment_value" type="integer" min="0" max="40" value="38" label="Maximum score threshold to conserve sequences" help="(-max_qual_score)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="mean_quality_filter_treatments">
                            <param name="apply_mean_quality_filter_treatments" type="select" label="Filter sequences based on their mean score?" help="By default, sequences with a mean score below 15 are removed.">
                              <option value="true" selected="true">Yes</option>
                              <option value="false">No</option>
                            </param>
                            <when value="true">
                                <conditional name="min_mean_quality_filter_treatments">
                                    <param name="apply_min_mean_quality_filter_treatments" type="select" label="Filter sequences based with too small mean score?" help="By default, sequences with a mean score below 15 are removed.">
                                      <option value="true" selected="true">Yes</option>
                                      <option value="false">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="min_mean_quality_filter_treatment_value" type="integer" min="0" max="40" value="15" label="Minimum mean score threshold to conserve sequences" help="(-min_qual_mean)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="max_mean_quality_filter_treatments">
                                    <param name="apply_max_mean_quality_filter_treatments" type="select" label="Filter sequences based with too high mean score?" help="By default, no treatment based on a maximum mean score is made.">
                                      <option value="true">Yes</option>
                                      <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="max_mean_quality_filter_treatment_value" type="integer" min="0" max="40" value="40" label="Maximum mean score threshold to conserve sequences" help="(-max_qual_mean)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="base_content_filter_treatments">
                    <param name="apply_base_content_filter_treatments" type="select" label="Filter sequences based on their base content?" help="By default, sequences with more than 2% of N bases are removed.">
                      <option value="true" selected="true">Yes</option>
                      <option value="false">No</option>
                    </param>
                    <when value="true">
                        <conditional name="GC_perc_content_filter_treatments">
                            <param name="apply_GC_perc_content_filter_treatments" type="select" label="Filter sequences based on their GC percentage?" help="By default, no treatment based on GC percentage is made.">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <conditional name="min_GC_perc_content_filter_treatments">
                                    <param name="apply_min_GC_perc_content_filter_treatments" type="select" label="Filter sequences with too small GC percentage?" help="By default, no treatment based on GC percentage is made.">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="min_GC_perc_content_filter_treatment_value" type="integer" min="0" max="100" value="10" label="Minimal GC percentage threshold to conserve sequences" help="(-min_gc)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="max_GC_perc_content_filter_treatments">
                                    <param name="apply_max_GC_perc_content_filter_treatments" type="select" label="Filter sequences with too high GC percentage?" help="By default, no treatment based on GC percentage is made.">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="max_GC_perc_content_filter_treatment_value" type="integer" min="0" max="100" value="90" label="Maximal GC percentage threshold to conserve sequences" help="(-max_gc)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="N_number_content_filter_treatments">
                            <param name="apply_N_number_content_filter_treatments" type="select" label="Filter sequences based on their number of N bases?" help="By default, no treatment based on N number is made.">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <param name="N_number_content_filter_treatment_value" type="integer" min="0" max="3000" value="10" label="Maximal N number threshold to conserve sequences" help="(-ns_max_n)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="N_percentage_content_filter_treatments">
                            <param name="apply_N_percentage_content_filter_treatments" type="select" label="Filter sequences based on their percentage of N bases?" help="By default, sequences with more than 2% of N bases are removed.">
                                <option value="true" selected="true">Yes</option>
                                <option value="false">No</option>
                            </param>
                            <when value="true">
                                <param name="N_percentage_content_filter_treatment_value" type="integer" min="0" max="100" value="2" label="Maximal N percentage threshold to conserve sequences" help="(-ns_max_p)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <param name='apply_other_base_content_filter_treatments' type='boolean' truevalue="-noniupac" falsevalue="" checked="false" label="Filter sequences with characters other than A, T, C, G and N?" help="By default, this treatment is not made. (-noniupac)"/>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="complexity_filter_treatments">
                    <param name="apply_complexity_filter_treatments" type="select" label="Filter sequences based on their complexity?" help="By default, no complexity filter is applied.">
                        <option value="true">Yes</option>
                        <option value="false" selected="true">No</option>
                    </param>
                    <when value="true">
                        <param name="method_complexity_filter_treatments" type="select" display="radio" label="Method to filter low complexity sequences" help="(-lc_method)">
                            <option value="dust">Dust</option>
                            <option value="entropy" >Entropy</option>
                        </param>
                        <param name="threshold_complexity_filter_treatments" type="integer" min="0" max="100" value="2" label="Threshold value used to filter sequences by sequence complexity" help="The dust method uses the threshold as maximum allowed score and the entropy method as minimum allowed value.(-lc_threshold)"/>
                    </when>
                    <when value="false" />
                </conditional>
            </when>
            <when value="false" />
        </conditional>

        <conditional name="trimming_treatments">
            <param name="apply_trimming_treatments" type="select" label="Apply trimming treatments?" help="">
                <option value="true" selected="true">Yes</option>
                <option value="false">No</option>
            </param>
            <when value="true">
                <conditional name="length_trimming_treatments">
                    <param name="apply_length_trimming_treatments" type="select" label="Trim all sequences from the 3'-end to a defined length?" help="By default, no length trimming is made">
                        <option value="true">Yes</option>
                        <option value="false" selected="true">No</option>
                    </param>
                    <when value="true">
                        <param name="length_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Length of sequences after trimming" help="(-trim_to_len)"/>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="position_trimming_treatments">
                    <param name="apply_position_trimming_treatments" type="select" label="Trim all sequences from the ends?" help="By default, no position trimming is made">
                        <option value="true">Yes</option>
                        <option value="false" selected="true">No</option>
                    </param>
                    <when value="true">
                        <conditional name="nb_position_trimming_treatments">
                            <param name="apply_nb_position_trimming_treatments" type="select" label="Trim sequences by a defined number of positions?" help="By default, no position trimming is made">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <conditional name="left_position_trimming_treatments">
                                    <param name="apply_left_position_trimming_treatments" type="select" label="Trim sequences at the 5'-end by a defined number of positions?" help="By default, no position trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="left_position_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Number of positions to trim on 5'-end" help="(-trim_left)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="right_position_trimming_treatments">
                                    <param name="apply_right_position_trimming_treatments" type="select" label="Trim sequences at the 3'-end by a defined number of positions?" help="By default, no position trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="right_position_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Number of positions to trim on 3'-end" help="(-trim_right)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="percentage_position_trimming_treatments">
                            <param name="apply_percentage_position_trimming_treatments" type="select" label="Trim sequences by a defined percentage of read length?" help="The trim length is rounded towards the lower integer. By default, no position trimming is made">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <conditional name="left_percentage_position_trimming_treatments">
                                    <param name="apply_left_percentage_position_trimming_treatments" type="select" label="Trim sequences at the 5'-end by a defined percentage of read length?" help="The trim length is rounded towards the lower integer. By default, no position trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="left_percentage_position_trimming_treatment_value" type="integer" min="0" max="100" value="2" label="Percentage of positions to trim on 5'-end" help="(-trim_left_p)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="right_percentage_position_trimming_treatments">
                                    <param name="apply_right_percentage_position_trimming_treatments" type="select" label="Trim sequences at the 3'-end by a defined percentage of read length?" help="The trim length is rounded towards the lower integer. By default, no position trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="right_percentage_position_trimming_treatment_value" type="integer" min="0" max="100" value="2" label="Percentage of positions to trim on 3'-end" help="(-trim_right_p)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="tail_trimming_treatments">
                    <param name="apply_tail_trimming_treatments" type="select" label="Trim tails?" help="By default, no tail trimming is made">
                        <option value="true">Yes</option>
                        <option value="false" selected="true">No</option>
                    </param>
                    <when value="true">
                        <conditional name="a_t_tail_trimming_treatments">
                            <param name="apply_a_t_tail_trimming_treatments" type="select" label="Trim poly-A/T tail?" help="By default, no poly-A/T tail trimming is made">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <conditional name="left_a_t_tail_trimming_treatments">
                                    <param name="apply_left_a_t_tail_trimming_treatments" type="select" label="Trim poly-A/T tail at the 5'-end?" help="By default, no 5'-end poly-A/T tail trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="left_a_t_tail_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Minimum length of poly-A/T to trim at the 5'-end" help="(-trim_tail_left)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="right_a_t_tail_trimming_treatments">
                                    <param name="apply_right_a_t_tail_trimming_treatments" type="select" label="Trim poly-A/T tail at the 3'-end?" help="By default, no 3'-end poly-A/T tail trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="right_a_t_tail_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Minimum length of poly-A/T to trim at the 5'-end" help="(-trim_tail_right)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="ns_tail_trimming_treatments">
                            <param name="apply_ns_tail_trimming_treatments" type="select" label="Trim poly-N tail?" help="By default, no poly-N tail trimming is made">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <conditional name="left_ns_tail_trimming_treatments">
                                    <param name="apply_left_ns_tail_trimming_treatments" type="select" label="Trim poly-N tail at the 5'-end?" help="By default, no 5'-end poly-N tail trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="left_ns_tail_trimming_treatment_value"  type="integer" min="0" max="3000" value="100" label="Minimum length of poly-N to trim at the 5'-end" help="(-trim_ns_left)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                                <conditional name="right_ns_tail_trimming_treatments">
                                    <param name="apply_right_ns_tail_trimming_treatments" type="select" label="Trim poly-N tail at the 3'-end?" help="By default, no 3'-end poly-N tail trimming is made">
                                        <option value="true">Yes</option>
                                        <option value="false" selected="true">No</option>
                                    </param>
                                    <when value="true">
                                        <param name="right_ns_tail_trimming_treatment_value" type="integer" min="0" max="3000" value="100" label="Minimum length of poly-N to trim at the 5'-end" help="(-trim_ns_right)"/>
                                    </when>
                                    <when value="false" />
                                </conditional>
                            </when>
                            <when value="false" />
                        </conditional>
                    </when>
                    <when value="false" />
                </conditional>
                <conditional name="quality_trimming_treatments">
                    <param name="apply_quality_trimming_treatments" type="select" label="Trim sequence by quality score?" help="By default, a 3'-end trimming is made to remove ends with a minimum quality score over 5 bp below 20">
                        <option value="true" selected="true">Yes</option>
                        <option value="false">No</option>
                    </param>
                    <when value="true">
                        <conditional name="left_quality_trimming_treatments">
                            <param name="apply_left_quality_trimming_treatments" type="select" label="Trim sequence by quality score from the 5'-end?" help="By default, no 5'-end quality trimming is made">
                                <option value="true">Yes</option>
                                <option value="false" selected="true">No</option>
                            </param>
                            <when value="true">
                                <param name="left_quality_trimming_treatment_value" type="integer" min="0" max="40" value="20" label="Quality score threshold to trim positions" help="(-trim_qual_left)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <conditional name="right_quality_trimming_treatments">
                            <param name="apply_right_quality_trimming_treatments" type="select" label="Trim sequence by quality score from the 3'-end?" help="By default, 3'-end trimming is made based on a score of 20">
                                <option value="true" selected="true">Yes</option>
                                <option value="false">No</option>
                            </param>
                            <when value="true">
                                <param name="right_quality_trimming_treatment_value" type="integer" min="0" max="40" value="20" label="Quality score threshold to trim positions" help="(-trim_qual_right)"/>
                            </when>
                            <when value="false" />
                        </conditional>
                        <param name="type_quality_trimming_treatments" type="select" display="radio" label="Type of quality score calculation to use" help="By default, min is used. (-trim_qual_type)">
                            <option value="min" selected="true">Mininum</option>
                            <option value="mean" >Mean</option>
                            <option value="max" >Max</option>
                            <option value="sum" >Sum</option>
                        </param>
                        <param name="rule_quality_trimming_treatments" type="select" display="radio" label="Rule tu use to compare quality score to calculated value" help="By default, 'less than' is used. (-trim_qual_rule)">
                            <option value="lt" selected="true">Less than</option>
                            <option value="gt" >Greater than</option>
                            <option value="et" >Equal to</option>
                        </param>
                        <param name="window_quality_trimming_treatments" type="integer" min="0" max="300" value="1" label="Size of the sliding window used to calculated quality score by type" help="To stop at the first base that fails the rule defined, use a window size of 1 (default value). (-trim_qual_window)"/>
                        <param name="step_quality_trimming_treatments" type="integer" min="0" max="300" value="1" label="Step size used to move the sliding window" help="To move the window over all quality scores without missing any, the step size sould be less or equal to the window size. The default value is 1. (-trim_qual_step)"/>
                    </when>
                    <when value="false" />
                </conditional>
            </when>
            <when value="false" />
        </conditional>

        <!--<param name="graph_stats" type="select" multiple="True" label="Which statistics should be calculated included in the graph_data file" help="(-graph_stats)">
            <option value="ld" selected="True">Length distribution</option>
            <option value="gc" selected="True">GC content distribution</option>
            <option value="qd" selected="True">Base quality distribution</option>
            <option value="ns" selected="True">Occurence of N</option>
            <option value="pt" selected="True">Poly-A/T tails</option>
            <option value="ts" selected="True">Tag sequence check</option>
            <option value="aq" selected="True">Assembly quality measure</option>
            <option value="de" selected="True">Sequence duplication - exact only</option>
            <option value="da" selected="True">Sequence duplication - exact + 5'/3'</option>
            <option value="sc" selected="True">Sequence complexity</option>
            <option value="dn" selected="True">Dinucleotide odds ratios, includes the PCA plots</option>
        </param>-->
    </inputs>

    <outputs>
        <data format_source="input_singles" name="good_sequence_file" from_work_dir="tmp/good_sequences.fastq"
            label="${tool.name} on ${on_string}: Good sequences" >
            <filter>seq_type['seq_type_opt'] == "single"</filter>
        </data>
        <data format_source="input_singles" name="rejected_sequence_file" from_work_dir="tmp/rejected_sequences.fastq"
            label="${tool.name} on ${on_string}: Rejected sequences" >
            <filter>seq_type['seq_type_opt'] == "single"</filter>
        </data>

        <data format_source="input_mate1" name="good_sequences_1_file" from_work_dir="tmp/good_sequences_1.fastq"
            label="${tool.name} on ${on_string}: Good sequences for R1" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>
        <data format_source="input_mate1" name="good_sequences_1_singletons_file" from_work_dir="tmp/good_sequences_1_singletons.fastq"
            label="${tool.name} on ${on_string}: Good singleton sequences for R1" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>
        <data format_source="input_mate1" name="rejected_sequence_1_file" from_work_dir="tmp/rejected_sequences_1.fastq"
            label="${tool.name} on ${on_string}: Rejected sequences for R1" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>
        <data format_source="input_mate2" name="good_sequences_2_file" from_work_dir="tmp/good_sequences_2.fastq"
            label="${tool.name} on ${on_string}: Good sequences for R2" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>
        <data format_source="input_mate2" name="good_sequences_2_singletons_file" from_work_dir="tmp/good_sequences_2_singletons.fastq"
            label="${tool.name} on ${on_string}: Good singleton sequences for R2" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>
        <data format_source="input_mate2" name="rejected_sequence_2_file" from_work_dir="tmp/rejected_sequences_2.fastq"
            label="${tool.name} on ${on_string}: Rejected sequences for R2" >
            <filter>seq_type['seq_type_opt'] == "paired"</filter>
        </data>

        <collection name="good_sequences_collection" type="paired">
            <filter>seq_type['seq_type_opt'] == "paired_collection"</filter>
        </collection>

        <collection name="singletons_collection" type="paired">
            <filter>seq_type['seq_type_opt'] == "paired_collection"</filter>
        </collection>

        <collection name="rejected_sequences_collection" type="paired">
            <filter>seq_type['seq_type_opt'] == "paired_collection"</filter>
        </collection>

        <!--<data format="html" name="html_file" from_work_dir="stats_html.html"
            label="${tool.name} on ${on_string}: Summary" />-->
    </outputs>

    <tests>
        <test>
            <param name='seq_type_opt' value="single"/>
            <param name="input_singles" value="prinseq_input_sequences.fastq" ftype="fastqsanger"/>
            <param name='apply_filter_treatments' value="true"/>
            <param name='apply_length_filter_treatments' value="true"/>
            <param name='apply_min_length_filter_treatments' value="true"/>
            <param name="min_length_filter_treatment_value" value="60"/>
            <param name='apply_max_length_filter_treatments' value="false" />
            <param name='apply_quality_filter_treatments' value="true"/>
            <param name='apply_min_quality_filter_treatments' value="false" />
            <param name='apply_max_quality_filter_treatments' value="false"/>
            <param name='apply_mean_quality_filter_treatments' value="true"/>
            <param name='apply_min_mean_quality_filter_treatments' value="true"/>
            <param name="min_mean_quality_filter_treatment_value" value="15"/>
            <param name='apply_max_mean_quality_filter_treatments' value="false"/>
            <param name='apply_base_content_filter_treatments' value="true"/>
            <param name='apply_GC_perc_content_filter_treatments' value="false"/>
            <param name='apply_N_number_content_filter_treatments' value="false"/>
            <param name='apply_N_percentage_content_filter_treatments' value="true"/>
            <param name="N_percentage_content_filter_treatment_value" value="2"/>
            <param name='apply_other_base_content_filter_treatments' value="false"/>
            <param name='apply_complexity_filter_treatments' value="false"/>
            <param name='apply_trimming_treatments' value="true" />
            <param name='apply_length_trimming_treatments' value="false"/>
            <param name='apply_position_trimming_treatments' value="false"/>
            <param name='apply_tail_trimming_treatments' value="false"/>
            <param name='apply_quality_trimming_treatments' value="true"/>
            <param name='apply_left_quality_trimming_treatments' value="false"/>
            <param name='apply_right_quality_trimming_treatments' value="true" />
            <param name="right_quality_trimming_treatment_value" value="20"/>
            <param name="type_quality_trimming_treatments" value="min"/>
            <param name="rule_quality_trimming_treatments" value="lt" />
            <param name="window_quality_trimming_treatments" value="1"/>
            <param name="step_quality_trimming_treatments" value="1"/>

            <output name="good_sequence_file" file="prinseq_good_sequences.fastq" ftype="fastqsanger"/>
        </test>
    </tests>

    <help><![CDATA[
**What it does**

PRINSEQ is a tool for easy and rapid quality control and data processing of metagenomic and metatranscriptomic datasets.
This tool allow to process the sequences with filtering and trimming.
More information on `PRINSEQ manual <http://prinseq.sourceforge.net/manual.html>`_.

-----

**Input**

The input file is sequence file in fastq format (sequences and quality)::

    @HWI-M00234:263:000000000-ADM55:1:1101:7508:4067 1:N:0:ATCACG
    GGTGCACTAGGATCGTAGTTGGCTACTTTCCCGTTTTCAATGTATACGCAAGGTACACGGTCAGCGGT
    +
    CCCCCGFGED8DDCAFDAEE9DFGGGG9CFAFFCC@@CFGFGGCGFGG>GGGFFGDGEFFEFG8>4GF

-----

**Parameters**

The parameters are numerous in PRINSEQ given the wanted treatments.

Several filter treatments are proposed:

  - Filters based on sequence length
  - Filters based on quality score
  - Filters based on base content

And several trimming treatments eliminate sequence parts:

  - Trim of ends
  - Trim of tails
  - Trim based quality score

All these treaments can be customed using proposed parameters.

-----

**Output**

The output file is a sequence file with sequences and quality from input file
which have undergone filter and trimming.
    ]]>
    </help>

    <citations>
        <citation type="doi">10.1093/bioinformatics/btr026</citation>
    </citations>
</tool>