view macros.xml @ 2:1f8df7e35393 draft

planemo upload for repository https://git.embl.de/grp-gbcs/Je/tree/master/src/galaxy commit 62411561ae3bc65ea8762d27ec79a7d912503e5b
author gbcs-embl-heidelberg
date Wed, 07 Dec 2016 11:57:30 -0500
parents 111ba1180318
children 01fdc6d10660
line wrap: on
line source

<macros>

    <token name="@single_or_paired_cmd@">
        #if str( $library.type ) == "single":
            F1=${library.input_1}
        #elif str( $library.type ) == "paired":
            F1=${library.input_1}
            F2=${library.input_2}
            SAME_HEADERS=${library.SAME_HEADERS}
        #else
            ## prepare paired-end collection
            F1=${library.input_1.forward}
            F2=${library.input_1.reverse}
            SAME_HEADERS=${library.SAME_HEADERS}
        #end if
    </token>

    <xml name="paired_options">
        <when value="paired">
            <param name="input_1" format="fastq,gz" type="data" label="FASTQ file #1"/>
            <param name="input_2" format="fastq,gz" type="data" label="FASTQ file #2"/>
            <yield />
            <param name="SAME_HEADERS" type="boolean"
                label="Ensure headers of both reads of a pair are identical (SAME_HEADERS)"
                help="Only applies if barcodes are added to the header (option ADD)"
                truevalue="true"
                falsevalue="false" checked="false"/>
        </when>
        <when value="paired_collection">
            <param name="input_1" format="fastq,gz" type="data_collection" collection_type="paired"
                label="FASTQ Paired Dataset"/>
            <yield />
            <param name="SAME_HEADERS" type="boolean"
                label="Ensure headers of both reads of a pair are identical (SAME_HEADERS)"
                help="Only applies if barcodes are added to the header (option ADD)"
                truevalue="true"
                falsevalue="false" checked="false"/>
        </when>
    </xml>

    <token name="@single_or_paired_illu_cmd@">
        @single_or_paired_cmd@
        I1=$library.I1
        #if str( $library.type ) != "single":
            #if str( $library.I2_CONDITIONAL.I2_AVAILABLE ) == "true":
                I2=${library.I2_CONDITIONAL.I2}
                BRED=${library.I2_CONDITIONAL.BRED_CONDITIONAL.BRED}
                #if str( $library.I2_CONDITIONAL.BRED_CONDITIONAL.BRED ) == "true":
                    STRICT=${library.I2_CONDITIONAL.BRED_CONDITIONAL.STRICT}
                #end if
            #end if
        #end if
    </token>

    <xml name="single_or_paired_illu">
        <conditional name="library">
            <param name="type" type="select" label="Is this single or paired library">
              <option value="single">Single-end</option>
              <option value="paired">Paired-end</option>
              <option value="paired_collection">Paired-end Dataset Collection</option>
            </param>
            <when value="single">
                <param name="input_1" format="fastq,gz" type="data" label="FASTQ file"/>
                <param name="I1" type="data" format="fastq,gz" label="First Index File"/>
            </when>
            <expand macro="paired_options">
                <param name="I1" type="data" format="fastq,gz" label="First Index File"/>
                <conditional name="I2_CONDITIONAL">
                    <param name="I2_AVAILABLE" type="select" label="Do you have a second index file?">
                        <option value="true">Yes</option>
                        <option value="false" selected="true">No</option>
                    </param>
                    <when value="true">
                        <param name="I2" type="data" format="fastq,gz" label="Second Index File"/>
                        <expand macro="bred_conditional"/>
                    </when>
                    <when value="false"/>
                </conditional>
            </expand>
        </conditional>
    </xml>

    <xml name="single_or_paired_general">
        <conditional name="library">
            <param name="type" type="select" label="Is this single or paired library">
              <option value="single">Single-end</option>
              <option value="paired">Paired-end</option>
              <option value="paired_collection">Paired-end Dataset Collection</option>
            </param>
            <when value="single">
                <param name="input_1" format="fastq,gz" type="data" label="FASTQ file"/>
            </when>
            <expand macro="paired_options">
                <yield />
            </expand>
        </conditional>
    </xml>

    <token name="@demultiplex_paired_end_cmd_options@">
        BPOS=$library.BPOS_CONDITIONAL.BPOS
        #if str( $library.BPOS_CONDITIONAL.BPOS ) == "BOTH":
            BM=${library.BPOS_CONDITIONAL.BM_CONDITIIONAL.BM}
            #if str( $library.BPOS_CONDITIONAL.BM_CONDITIIONAL.BM ) == "BOTH":
                BRED=${library.BPOS_CONDITIONAL.BM_CONDITIIONAL.BRED_CONDITIONAL.BRED}
                #if str( $library.BPOS_CONDITIONAL.BM_CONDITIIONAL.BRED_CONDITIONAL.BRED ) == "true":
                    STRICT=${library.BPOS_CONDITIONAL.BM_CONDITIIONAL.BRED_CONDITIONAL.STRICT}
                #end if
            #end if
        #end if
    </token>

    <xml name="demultiplex_paired_end_options">
        <conditional name="BPOS_CONDITIONAL">
            <param name="BPOS" type="select" label="Barcode read position (BPOS)" help="where are the barcodes">
                <option value="READ_1" selected="true">READ_1 (beginning of read from the first fastq file)</option>
                <option value="READ_2">READ_2 (beginning of read from the second fastq file)</option>
                <option value="BOTH">BOTH (beginning of both reads)</option>
            </param>
            <when value="READ_1"/>
            <when value="READ_2"/>
            <when value="BOTH">
                <conditional name="BM_CONDITIIONAL">
                    <param name="BM" type="select" label="Barcode for sample matching (BM)"
                        help="which barcode should be used for sample look up (BM option)." >
                        <option value="READ_1" selected="true">
                            READ_1 (beginning of read from the first fastq file)
                        </option>
                        <option value="READ_2">
                            READ_2 (beginning of read from the second fastq file)
                        </option>
                        <option value="BOTH">
                            BOTH (beginning of both reads)
                        </option>
                    </param>
                    <when value="READ_1"/>
                    <when value="READ_2"/>
                    <when value="BOTH">
                        <expand macro="bred_conditional"/>
                    </when>
                </conditional>
            </when>
        </conditional>
    </xml>

    <xml name="bred_conditional">
        <conditional name="BRED_CONDITIONAL">
            <param name="BRED" type="select" label="Redundant barcodes (BRED)"
                help="are the barcodes REDUNDANT i.e. do they both resolve to the same sample.">
                <option value="true" selected="true">Yes</option>
                <option value="false">No</option>
            </param>
            <when value="true">
                <param name="STRICT" type="boolean" label="Strict (S)"
                    truevalue="true"
                    falsevalue="false"
                    checked="false"
                />
            </when>
            <when value="false"/>
        </conditional>
    </xml>

    <token name="@barcode_option_cmd@">
        #if str( $barcodes.barcode_list_type_con ) == "text":
            BARCODE_FILE=${barcode_file_from_text}
        #else if str( $barcodes.barcode_list_type_con ) == "file":
            BARCODE_FILE=${barcodes.BARCODE_FILE}
        #end if
    </token>

    <xml name="barcode_option">
        <conditional name="barcodes">
            <param name="barcode_list_type_con" type="select" label="Barcode list input type">
              <option value="file" selected="true">Use a tab-delimited file from the history</option>
              <option value="text">Paste the barcodes list in a text field within the form</option>
            </param>

            <when value="file">
                <param name="BARCODE_FILE" type="data" format="tabular,txt" label="Barcode List"
                    help="Barcode list format: one sample per line. First column is sample name and second is the
                    barcode, separated by tab or space. A third and fourth column can be used to specify the resulting
                    file names. See help below."/>
            </when>

            <when value="text">
                <param name="barcode_text" type="text" area="True" size="10x30"
                    value="sample_name\tbarcode\n" label="Barcode List"
                    help="Barcode list format: one sample per line. First column is sample name and second is the
                    barcode, separated by tab or space. A third and fourth column can be used to specify the resulting
                    file names. See help below.">
                    <sanitizer>
                        <valid initial="string.printable"></valid>
                        <mapping initial="none"/>
                    </sanitizer>
                </param>
            </when>
        </conditional>
    </xml>

    <xml name="barcode_config_file">
        <configfile name="barcode_file_from_text">#set from_text_area = ''
#if str( $barcodes.barcode_list_type_con ) == "text":
#set from_text_area = $barcodes.barcode_text
#end if
${from_text_area}</configfile>
    </xml>

    <token name="@barcode_len_cmd@">
        #if str( $LEN ) != "":
            BCLEN=$LEN
        #end if
    </token>

    <xml name="barcode_len_option">
        <param name="LEN" type="text" value="" label="Barcode Length (LEN)"
            help="If 'Barcode read position'=BOTH and 'Redundant barcodes'=False, two distinct
                  lengths can be provided using the syntax LEN=X:Z where X and Z are 2 integers representing
                  the barcode length for read_1 and read_2 respectively. Default: empty"/>
    </xml>
    <xml name="clip_barcode">
        <param name="CLIP_BARCODE" type="boolean" label="Remove barcode sequence from read (C)"
           truevalue="true" falsevalue="false" checked="true"/>
    </xml>

    <token name="@demultiplexer_common_options_cmd@">
        ADD=${ADD}
        MM=$MM
        MMD=$MMD
        Q=$MIN_BASE_QUALITY
        QUALITY_FORMAT=$QUALITY_FORMAT
    </token>
    <xml name="demultiplexer_common_options">
        <param name="ADD" type="boolean"
            label="Add matched barcode at the end of the read header (ADD)"
            truevalue="true"
            falsevalue="false"
            checked="true"
        />
        <param name="MM" type="text" value="1" label="Maximum Mismatches (MM)"
            help="Maximum mismatches for a barcode to be considered a match." />

        <param name="MMD" type="text" value="1" label="Minimum mismatch difference (MMD)"
            help="Minimum difference between number of mismatches in the best and second best barcodes for a barcode
            to be considered a match." />

        <param name="MIN_BASE_QUALITY" type="text" value="10" label="Minimum base quality (Q)"
            help="Any barcode bases falling below this quality will be
            considered a mismatch even in the bases match." />

        <param name="QUALITY_FORMAT" type="select" label="Fastq Quality Format (V)"
            help="How are the quality values encoded in the fastq.  Either 'Solexa' for
            pre-pipeline 1.3 style scores (solexa scaling + 66), 'Illumina' for pipeline 1.3 and
            above (phred scaling + 64) or 'Standard' for phred scaled scores with a character shift
            of 33.">
            <option value="Standard" selected="true">
                Fastq - Illumina Casava v1.8 with Sanger coding quality (phred scaling + 33)
            </option>
            <option value="Illumina">
                Fastq - Illumina v1.3 or above coding of quality (phred scaling + 64)
            </option>
            <option value="Solexa">
                Fastq - Solexa-style quality (solexa scaling + 66)
            </option>
            <option value="null">
                Detect automatically
            </option>
        </param>
    </xml>

    <token name="@demultiplexer_common_output_options_cmd@">
        KEEP_UNASSIGNED_READ=$KEEP_UNASSIGNED_READ
        STATS_ONLY=${adv_options.STATS_ONLY}
        #if str( $adv_options.DIAG ) == "true":
            BARCODE_DIAG_FILE=$BARCODE_DIAG_FILE
        #end if
    </token>
    <xml name="demultiplexer_common_output_options">
        <param name="KEEP_UNASSIGNED_READ" type="boolean" label="Keep unassigned reads (KEEP_UNASSIGNED_READ)"
            truealue="true"
            falsevalue="false"
            checked="true"
        />
        <section name="adv_options" title="Advanced Options" expanded="False">
            <param name="DIAG" type="boolean" label="Output barcode match reporting file (DIAG)"
                truevalue="true" falsevalue="false" checked="false"
                help="This file will
                      contain a line per read pair with the barcode best matching the read subsequence or 'null' when no
                      match is found according to matching parameters. This file is useful for debugging or further
                      processing in case both ends are barcoded."/>
            <param name="STATS_ONLY" type="boolean" label="Only produce metric and diagnostic reports (STATS_ONLY)"
                truevalue="true" falsevalue="false" checked="false"
                help="do not demultiplex." />
        </section>
    </xml>

    <token name="@common_options_cmd@">
        XT=${XT}
        ZT=${ZT}
        #if str( $RCHAR ) != "":
            RCHAR=${RCHAR}
        #else:
            RCHAR=null
        #end if
        GZ=${GZ}
        OUTPUT_DIR=results
    </token>
    <xml name="common_options">
        <param name="XT" type="text" value="0"
            label="Extra number of bases to be trimmed right after the barcode (XT)" />
        <param name="ZT" type="text" value="0"
            label="Extra number of bases to be trimmed from the read end (ZT)" />

        <param name="RCHAR" type="text"
            label="Replace white space in the read name/header with speficied symbols (RCHAR)"
            help="Set to empty or null for no replacement."
            value=":"/>

        <param name="GZ" type="boolean" hidden="true" label="Compress output (GZ)"
            help="will result in fastq.gz files."
            truevalue="true"
            falsevalue="false"
            checked="false"/>
    </xml>

    <token name="@demultiplexer_common_outputs_cmd@">
        METRICS_FILE_NAME=$METRICS_FILE_NAME
    </token>
    <xml name="demultiplexer_common_outputs">
        <data name="METRICS_FILE_NAME" format="tabular" label="Je-Demultiplex result">
            <!--<discover_datasets pattern="(?P&lt;name&gt;.*)\.txt" ext="fastqsanger"-->
            <discover_datasets pattern="(?P&lt;name&gt;.*)\.txt" directory="results" visible="true" ext="fastqsanger"/>
        </data>
        <data name="BARCODE_DIAG_FILE" format="tabular" label="Barcode statistics">
            <filter>(adv_options['DIAG'] == 'true')</filter>
        </data>
    </xml>

</macros>