view umi-tools_extract.xml @ 5:f77bc14eba31 draft

planemo upload commit 57e3e460a740aa7aad217c8365527c49e88c9a30
author iuc
date Tue, 05 Jun 2018 19:44:38 -0400
parents e73a22ff585c
children 3cfd8e1073d7
line wrap: on
line source

<tool id="umi_tools_extract" name="UMI-tools extract" version="@VERSION@.1">
    <description>Extract UMI from fastq files</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <command detect_errors="exit_code"><![CDATA[
    @COMMAND_LINK@

    umi_tools extract
            --extract-method='$extract_method.value'
            --bc-pattern='$bc_pattern'

            #if $input_type.type == 'single':
                #if $gz:
                    --stdin=input_single.gz
                    --stdout out.gz
                #else
                    --stdin=input_single.txt
                    --stdout '$out'
                #end if
            #else:
                #if $gz:
                    --stdin=input_read1.gz
                    --read2-in=input_read2.gz
                    --stdout out1.gz
                    --read2-out=out2.gz
                #else:
                    --stdin=input_read1.txt
                    --read2-in=input_read2.txt
                    --stdout '$out1'
                    --read2-out='$out2'
                #end if
                #if $input_type.barcode.barcode_select == "both_reads":
                    --split-barcode
                    --bc-pattern2='$input_type.barcode.bc_pattern2'
                #end if
            #end if

            #if $barcodes.use_barcodes.value == 'yes':
                --filter-cell-barcode
                --whitelist='$barcodes.filter_barcode_file'
                '$barcodes.filter_correct.value'
            #end if

            #if not $prime3:
                --3prime
            #end if
            #if $quality.quality_selector =='true':
                --quality-filter-threshold '$quality.quality_filter_threshold'
                --quality-encoding '$quality.quality_encoding'
            #end if
            #if $print_log == "1":
                --log='$out_log'
            #else
                --supress-stats
            #end if
        #if $gz:
            #if $input_type.type == 'single':
                && mv out.gz '$out'
            #else
                && mv out1.gz '$out1'
                && mv out2.gz '$out2'
            #end if
        #end if
    ]]></command>
    <inputs>
        <expand macro="input_types" />

        <conditional name="barcodes" >
            <param name="use_barcodes" argument="--filter-cell-barcode" type="select" label="Use Known Barcodes?" >
                <option value="yes">Yes</option>
                <option value="no" selected="true" >No</option>
            </param>
            <when value="no" />
            <when value="yes" >
                <param name="filter_barcode_file" type="data" format="tsv" label="Barcode File" />
                <param name="filter_correct" argument="--error-correct-cell" type="boolean" truevalue="--error-correct-cell" falsevalue="" checked="false" label="Apply correction to cell barcodes?" help="This only applies if your barcode file has two columns output from the umi_tools whitelist command." />
            </when>
        </conditional>

        <param name="extract_method" type="select" label="Method to extract barcodes" >
            <option value="regex">Regular Expressions</option>
            <option value="string" selected="true">String</option>
        </param>
            
        <param name="bc_pattern" argument="--bc-pattern" type="text" label="Barcode pattern for first read"
            help="Use this option to specify the format of the UMI/barcode. Use Ns to
                    represent the random positions and Xs to indicate the bc positions.
                    Bases with Ns will be extracted and added to the read name. Remaining
                    bases, marked with an X will be reattached to the read.">
            <sanitizer invalid_char="">
                <valid initial="string.letters,string.digits">
                    <add value="!="/>
                    <add value="-"/>
                    <add value="_"/>
                    <add value="."/>
                    <add value="?"/>
                    <add value="&lt;"/><!-- left triangle bracket -->
                    <add value="&gt;"/><!-- right triangle bracket -->
                    <add value="&#91;"/> <!-- left square bracket -->
                    <add value="&#93;"/> <!-- right square bracket -->
                    <add value="&#94;"/> <!-- caret -->
                    <add value="&#123;"/> <!-- left curly -->
                    <add value="&#125;"/> <!-- right curly -->
                    <add value="&#40;"/> <!-- left parenthesis -->
                    <add value="&#41;"/> <!-- right parenthesis -->
                </valid>
            </sanitizer>
        </param>

        <param name="prime3" argument="--3prime" type="boolean" label="Is the barcode at the 5' end?"
            truevalue="1" falsevalue="0" checked="true"
            help="By default the barcode is assumed to be on the 5' end of the read, but
                use this option to sepecify that it is on the 3' end instead." />
        <param name="print_log" argument="-L" type="boolean" label="Output log?"
            truevalue="1" falsevalue="0" checked="true"
            help="Choose if you want to generate a text file containing logging information." />
        <conditional name="quality">
            <param name="quality_selector" type="select" label="Enable quality filter?" >
                <option value="false">No</option>
                <option value="true">Yes</option>
            </param>
            <when value="false">
            </when>
            <when value="true">
                <param name="quality_filter_threshold" label="Phred score threshold"
                    type="integer" value="20" argument="--quality-filter-threshold"
                    help="Remove reads where any UMI base quality score falls below this threshold." />
                <param name="quality_encoding" argument="--quality-encoding" type="select" label="Library type"
                    help="Quality score encoding. Choose from phred33 [33-77], phred64 [64-106] or solexa [59-106].">
                    <option value="phred33">phred33 [33-77]</option>
                    <option value="phred64">phred64 [64-106]</option>
                    <option value="solexa">solexa [59-106]</option>
                </param>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="out" format_source="input_single">
            <filter>input_type['type'] == "single"</filter>
        </data>
        <data name="out1" format_source="input_read1">
            <filter>input_type['type'] !== "single"</filter>
        </data>
        <data name="out2" format_source="input_read2">
            <filter>input_type['type'] !== "single"</filter>
        </data>
        <data name="out_log" format="txt">
            <filter>print_log == True</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="type" value="single" />
            <param name="input_single" value="t_R1.fastq" ftype="fastq" />
            <param name="bc_pattern" value="XXXNNN" />
            <param name="prime3" value="0" />
            <param name="quality_selector" value="true" />
            <param name="quality_filter_threshold" value="10" />
            <param name="quality_encoding" value="phred33" />
            <output name="out" file="out_SE.fastq" />
            <output name="out_log" file="out_single.log" lines_diff="22"/>
        </test>
        <test>
            <param name="type" value="paired" />
            <param name="input_read1" value="t_R1.fastq.gz" ftype="fastq.gz" />
            <param name="input_read2" value="t_R2.fastq.gz" ftype="fastq.gz" />
            <param name="bc_pattern" value="NNNXXX" />
            <output name="out1" file="out_R1.fastq.gz" decompress="true" lines_diff="2" />
            <output name="out2" file="out_R2.fastq.gz" decompress="true" lines_diff="2" />
            <output name="out_log" file="out_paired.log" lines_diff="16"/>
        </test>
        <test>
            <param name="type" value="paired_collection" /> <!-- same as before, but uncompressed -->
            <param name="input_readpair" >
                <collection type="paired">
                    <element name="forward" ftype="fastq" value="t_R1.fastq" />
                    <element name="reverse" ftype="fastq" value="t_R2.fastq" />
                </collection>
            </param>
            <param name="bc_pattern" value="NNNXXX" />
            <output name="out1" file="out_R1.fastq.gz" decompress="true" lines_diff="2" />
            <output name="out2" file="out_R2.fastq.gz" decompress="true" lines_diff="2" />
            <output name="out_log" file="out_paired.log" lines_diff="25" />
        </test>
        <test>
            <param name="type" value="paired" />
            <param name="input_read1" value="scrb_seq_fastq.1.gz" ftype="fastq.gz" />
            <param name="input_read2" value="scrb_seq_fastq.2.gz" ftype="fastq.gz" />
            <param name="extract_method" value="string" />
            <param name="bc_pattern" value="CCCCCCNNNNNNNNNN" />
            <param name="use_barcodes" value="yes" />
            <param name="filter_barcode_file" value="scrb_seq_barcodes" />
            <output name="out2" file="scrb_extract.fastq.gz" decompress="true" />
        </test>
        <test><!-- same as above but with regex barcode-->
            <param name="type" value="paired" />
            <param name="input_read1" value="scrb_seq_fastq.1.gz" ftype="fastq.gz" />
            <param name="input_read2" value="scrb_seq_fastq.2.gz" ftype="fastq.gz" />
            <param name="extract_method" value="regex" />
            <param name="bc_pattern" value="^(?P&lt;cell_1&gt;.{6})(?P&lt;umi_1&gt;.{10})" />
            <param name="use_barcodes" value="yes" />
            <param name="filter_barcode_file" value="scrb_seq_barcodes" />
            <output name="out2" file="scrb_extract.fastq.gz" decompress="true" />
        </test>
    </tests>
    <help><![CDATA[


UMI-tools extract.py - Extract UMI from fastq
=============================================

Purpose
-------

Extract UMI barcode from a read and add it to the read name, leaving
any sample barcode in place. Can deal with paired end reads and UMIs
split across the paired ends

Options
-------

--split-barcode
       By default the UMI is assumed to be on the first read. Use this
       option if the UMI is contained on both reads and specify the
       pattern of the barcode/UMI on the second read using the option
       ``--bc-pattern2``

--bc-pattern
       Use this option to specify the format of the UMI/barcode. Use Ns to
       represent the random positions and Xs to indicate the bc positions.
       Bases with Ns will be extracted and added to the read name. Remaining
       bases, marked with an X will be reattached to the read.

       E.g. If the pattern is NNXXNN,
       Then the read:

       @HISEQ:87:00000000 read1
       AAGGTTGCTGATTGGATGGGCTAG
       DA1AEBFGGCG01DFH00B1FF0B
       +

       will become:
       @HISEQ:87:00000000_AATT read1
       GGGCTGATTGGATGGGCTAG
       1AFGGCG01DFH00B1FF0B
       +

--bc-pattern2
       Use this option to specify the format of the UMI/barcode for
       the second read pair if required. If --bc-pattern2 is not
       supplied, this defaults to the same pattern as --bc-pattern

--3prime
       By default the barcode is assumed to be on the 5' end of the read, but
       use this option to sepecify that it is on the 3' end instead

-L
       Specify a log file to retain logging information and final statistics

--split-barcode
       barcode is split across read pair

--quality-filter-threshold=QUALITY_FILTER_THRESHOLD
       Remove reads where any UMI base quality score falls
       below this threshold
--quality-encoding=QUALITY_ENCODING
       Quality score encoding. Choose from phred33[33-77]
       phred64 [64-106] or solexa [59-106]

Usage:
------

For single ended reads:
        umi_tools extract --bc-pattern=[PATTERN] -L extract.log [OPTIONS]

reads from stdin and outputs to stdout.

For paired end reads:
        umi_tools extract --bc-pattern=[PATTERN] --read2-in=[FASTQIN] --read2-out=[FASTQOUT] -L extract.log [OPTIONS]

reads end one from stdin and end two from FASTQIN and outputs end one to stdin
and end two to FASTQOUT.

    ]]></help>
    <expand macro="citations" />
</tool>