Repository revision
7:110a346daf36

Repository 'stacks2_clonefilter'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter

Stacks2: clone filter tool metadata
Miscellaneous
Identify PCR clones
stacks2_clonefilter
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy4
2.55+galaxy4
process_radtags -h |& grep process_radtags | head -n 1 | cut -d" " -f 2
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy4 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy3
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.55+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.53+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.4+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/stacks2_clonefilter/stacks2_clonefilter/2.4+galaxy0
stacks2_clonefilter
Requirements (dependencies defined in the <requirements> tag set)
name version type
stacks 2.55 package
python 3.7 package
findutils 4.6.0 package
Additional information about this tool
#from os.path import splitext
    #import re

    #def clean_ext($identifier)
        #while $identifier.endswith(('.1', '.2', '.fa', '.fq', '.fasta', '.fastq', '.gz', '.gzip', '.sam', '.bam'))
            #set $identifier = splitext($identifier)[0]
        #end while
$identifier#slurp
    #end def

    #def fastq_input_foo( $sample, $read_direction="", $infix="" )
        #set $name = $clean_ext($sample.element_identifier)
        #if $sample.is_collection:
            #set $cur_sample=$sample[$read_direction]
        #else:
            #set $cur_sample=$sample
        #end if

        #if $cur_sample.is_of_type('fastqsanger')
            #set $ext =  "fastq"
            #set $inputype = "fastq"
        #else if $cur_sample.is_of_type('fastqsanger.gz')
            #set $ext = "fastq.gz"
            #set $inputype = "gzfastq"
        #else if $cur_sample.is_of_type('fasta')
            #set $ext = "fasta"
            #set $inputype = "fasta"
        #else if $cur_sample.is_of_type('fasta.gz')
            #set $ext = "fasta.gz"
            #set $inputype = "gzfasta"
        #else
            #set $inputype = "UNKNOWN"
        #end if
        #set $data_path = "stacks_inputs/"+$name+$infix+"."+$ext
        #set $link_cmd = "ln -s '%s' '%s' &&" % ($cur_sample, $data_path)
        #return ($link_cmd, $data_path, $name, $inputype)
    #end def

    ## fastq_input_batch determine link command, access path(s), and input type
    ## for batch tools
    ##
    ## inputs
    ## - sample data set / pair
    ## - type "single" / "paired"
    ## return (link_command, fwd_path, rev_path, inputype)
    ## - link_command bash command(s) to link the data sets
    ## - fwd_path file name of the link to the forward data set
    ## - rev_path file name of the link to the forward data set (if type=paired)
    ## - inputype input type as used in stacks ([gz]fast(a|q))
    #def fastq_input_batch($sample, $type)
        #if $type == "single"
            #set ($link_cmd, $path, $name, $inputype) = $fastq_input_foo($sample, "", "")
            #return ($link_cmd, $path, "", $inputype)
        #else:
            #set ($fwd_link_cmd, $fwd_path, $name, $inputype) = $fastq_input_foo($sample, "forward", ".1")
            #set ($rev_link_cmd, $rev_path, $name, $inputype) = $fastq_input_foo($sample, "reverse", ".2")
            #return ( $fwd_link_cmd+$rev_link_cmd, $fwd_path, $rev_path, $inputype)
        #end if
    #end def

    ## fastq_input_nonbatch determine link command, access path(s), and input type
    ## for non-batch tools (procrad, shortreads, denovomap the former need R[12]_
    ## and the latter needs .[12])
    ##
    ## inputs
    ## - samples list of data set / pair
    ## - type "single" / "paired"
    ## - infix_pattern pattern for the infix of the files (needs to contain %d which is replaced by 1/2)
    ## return (link_command, inputype)
    ## - link_command bash command(s) to link the data sets
    ## - inputype input type as used in stacks ([gz]fast(a|q))
    #def fastq_input_nonbatch( $samples, $type, $infix_pattern )
        #set $link_command = ""
        #for $sample in $samples
            #if $type == "single"
                #set ($lc, $path, $name, $inputype) = $fastq_input_foo($sample, "", "")
                #set link_command += lc
            #else:
                #set ($lc, $path, $name, $inputype) = $fastq_input_foo($sample, "forward", $infix_pattern % (1))
                #set link_command += lc
                #set ($lc, $path, $name, $inputype) = $fastq_input_foo($sample, "reverse", $infix_pattern % (2))
                #set link_command += lc
            #end if
        #end for
        #return ($link_command, $inputype)
    #end def
    

trap ">&2 cat '$output_log'" err exit &&
mkdir stacks_inputs stacks_outputs &&

#set ($link_command, $fwd_path, $rev_path, $inputype) = $fastq_input_batch($input_type.fqinputs, $input_type.input_type_select)
$link_command

clone_filter
#if $input_type.input_type_select == 'single':
    -f '$fwd_path'
#else
    -1 '$fwd_path'
    -2 '$rev_path'
#end if

-i $inputype

-o stacks_outputs
$capture
$input_type.barcode_encoding
#if $oligo_len_1
    --oligo_len_1 $oligo_len_1
#end if
#if $oligo_len_2
    --oligo_len_2 $oligo_len_2
#end if
$retain_oligo
## only supports fastq.gz output since the
## the program outputs empty files for fasta/fastq
-y gzfastq

        #if $output_log
            2> '$output_log'
        #end if
    

## move outputs such that Galaxy can find them
#if $capture:
    #if $input_type.input_type_select == "single"
        && mv stacks_outputs/*.discards.fq.gz '$discarded'
    #else
        && mv stacks_outputs/*.discards.1.fq.gz '$discarded_pair.forward'
        && mv stacks_outputs/*.discards.2.fq.gz '$discarded_pair.reverse'
    #end if
#end if
#if $input_type.input_type_select == "single"
    && mv stacks_outputs/*.fq.gz '$clean'
#else
    && mv stacks_outputs/*.1.fq.gz '$clean_pair.forward'
    && mv stacks_outputs/*.2.fq.gz '$clean_pair.reverse'
#end if
None
False
Functional tests
name inputs outputs required files
Test-1 input_type|fqinputs: clonefilter/R1_0001.1.fq.gz
input_type|input_type_select: single
oligo_len_1: 6
add_log: True
name: value
name: value
clonefilter/R1_0001.1.fq.gz
value
Test-2 input_type|fqinputs: clonefilter/R1_0001.1.fq.gz
input_type|barcode_encoding: --index_null
input_type|input_type_select: single
capture: True
oligo_len_1: 6
name: value
name: value
name: value
clonefilter/R1_0001.1.fq.gz
value
Test-3 input_type|fqinputs: paired collection
input_type|input_type_select: paired
oligo_len_1: 6
name: value
clonefilter/R1_0001.1.fq.gz
clonefilter/R2_0001.2.fq.gz
value
Test-4 input_type|fqinputs: paired collection
input_type|input_type_select: paired
capture: True
oligo_len_1: 6
oligo_len_2: 6
retain_oligo: True
name: value
clonefilter/R1_0001.1.fq.gz
clonefilter/R2_0001.2.fq.gz
value