view stacks_cstacks.xml @ 2:8427e904f352 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/stacks2 commit 9c41b2599125298b1a4d9ffb2511cdc87ff79a73
author matthias
date Tue, 18 Dec 2018 12:52:48 -0500
parents d31714d7f03e
children 61afc5a3cd8e
line wrap: on
line source

<tool id="stacks2_cstacks" name="Stacks2: cstacks" version="@STACKS_VERSION@+galaxy@WRAPPER_VERSION@">
    <description>build a catalogue of loci</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <command><![CDATA[
#import re

mkdir stacks_inputs stacks_outputs
&&

## for each input collection
## - create links all tsv files that are not catalog
##   (ustacks produces ony tags, alleles, snps, ie eventually 
##    present catalogs are ignored)
##   link name is element_identifier(.tsv)
## - create -s sample1prefix -s sample2prefix .. 

#set $samples = ""
#for $input_file in $input_col
    #set $filename = str($input_file.element_identifier)
    #if not filename.endswith('.tsv')
        #set $filename = $filename + ".tsv"
    #end if
    #if not re.search('catalog\.[a-z]+(\.tsv)?$', $filename)
        ln -s '${input_file}' 'stacks_inputs/$filename' &&

        #if $filename.endswith('.tags.tsv')
            #set samples += " -s 'stacks_inputs/" + $filename[:-9] + "'"
        #end if
    #end if
#end for

cstacks

-p \${GALAXY_SLOTS:-1}

#if $popmap
    -P stacks_inputs
    -M '$popmap'
#else
    $samples
    -o stacks_outputs
#end if

-n $n
## -c not implemented in Galaxy (appending can be done in Galaxy)

@GAP_OPTIONS@

## Advanced Options
#if $k_len:
    --k_len $k_len
#end if
$report_mmatches
@TEE_APPEND_LOG@ 
@CAT_LOG_TO_STDERR@ 

#if $popmap
    ## When using a popmap, cstacks writes to the input dir
    && mv stacks_inputs/catalog.*.tsv stacks_outputs/
#end if

    ]]></command>

    <inputs>
        <param name="input_col" format="tabular,txt" type="data_collection" collection_type="list" label="Output from previous Stacks pipeline steps (e.g. denovo_map, refmap, ustacks or pstacks)" />

        <param name="popmap" type="data" format="tabular,txt" label="Population map" help="If set, the catalog will be built from samples listed in this file" optional="true" argument="-M" />

        <param argument="-n" type="integer" value="1" label="Number of mismatches allowed between sample loci when building the catalog" help="(default 1; suggested: set to ustacks -M)"/>

        <expand macro="gap_options"/>
        <param argument="--k_len" type="integer" min="5" max="31" value="" optional="true" label="k-mer size for matching between between catalog loci" help="default: automatic"/>
        <param argument="--report_mmatches" type="boolean" checked="false" truevalue="--report_mmatches" falsevalue="" label="report query loci that match more than one catalog locus" />
        <expand macro="in_log"/>
    </inputs>

    <outputs>
        <expand macro="out_log"/>
        <expand macro="cstacks_outputs_macro"/>
    </outputs>

    <tests>
        <!-- TODO add test w popmap -->
        <!-- test w default options -->
        <test>
            <param name="input_col">
                <collection type="list">
                    <element name="PopA_01.alleles.tsv" ftype="tabular" value="ustacks/PopA_01.alleles.tsv" />
                    <element name="PopA_01.snps.tsv" ftype="tabular" value="ustacks/PopA_01.snps.tsv" />
                    <element name="PopA_01.tags.tsv" ftype="tabular" value="ustacks/PopA_01.tags.tsv" />
                    <element name="PopA_02.alleles.tsv" ftype="tabular" value="ustacks/PopA_02.alleles.tsv" />
                    <element name="PopA_02.snps.tsv" ftype="tabular" value="ustacks/PopA_02.snps.tsv" />
                    <element name="PopA_02.tags.tsv" ftype="tabular" value="ustacks/PopA_02.tags.tsv" />
               </collection>
            </param>
            <param name="add_log" value="yes" />
            <output name="output_log"><assert_contents><has_text text="done." /></assert_contents></output>
            <output_collection name="catalog" type="list">
                <element name="catalog.alleles" file="cstacks/catalog.alleles.tsv" ftype="tabular" lines_diff="2"/>
                <element name="catalog.snps" file="cstacks/catalog.snps.tsv" ftype="tabular" lines_diff="2" />
                <element name="catalog.tags" file="cstacks/catalog.tags.tsv" ftype="tabular" lines_diff="2" />
            </output_collection>
        </test>
        <!-- test w non default options (wo gapped, because tested already in ustacks) -->
        <test>
            <param name="input_col">
                <collection type="list">
                    <element name="PopA_01.alleles.tsv" ftype="tabular" value="ustacks/PopA_01.alleles.tsv" />
                    <element name="PopA_01.snps.tsv" ftype="tabular" value="ustacks/PopA_01.snps.tsv" />
                    <element name="PopA_01.tags.tsv" ftype="tabular" value="ustacks/PopA_01.tags.tsv" />
                    <element name="PopA_02.alleles.tsv" ftype="tabular" value="ustacks/PopA_02.alleles.tsv" />
                    <element name="PopA_02.snps.tsv" ftype="tabular" value="ustacks/PopA_02.snps.tsv" />
                    <element name="PopA_02.tags.tsv" ftype="tabular" value="ustacks/PopA_02.tags.tsv" />
               </collection>
            </param>
            <param name="n" value="2"/>
            <param name="k_len" value="23"/>
            <param name="report_mmatches" value="--report_mmatches" />
            <assert_command>
                <has_text text="--k_len 23" />
                <has_text text="-n 2" />
                <has_text text="--report_mmatches" />
            </assert_command>
            <param name="add_log" value="yes" />
            <output name="output_log"><assert_contents><has_text text="done." /></assert_contents></output>
            <output_collection name="catalog" type="list">
                <element name="catalog.alleles" file="cstacks/catalog.alleles.tsv" ftype="tabular" lines_diff="2"/>
                <element name="catalog.snps" file="cstacks/catalog.snps.tsv" ftype="tabular" lines_diff="2" />
                <element name="catalog.tags" file="cstacks/catalog.tags.tsv" ftype="tabular" lines_diff="2" />
            </output_collection>
        </test>
    </tests>
    <help>
<![CDATA[
.. class:: infomark

**What it does**

A catalog can be built from any set of samples processed by the ustacks or pstacks programs. It will create a set of consensus loci, merging alleles together. In the case of a genetic cross, a catalog would be constructed from the parents of the cross to create a set of all possible alleles expected in the progeny of the cross.

--------

**Input files**

Output from denovo_map, refmap, ustacks or pstacks

**Output files**

- XXX.tags.tsv file:

See `Stacks output description <http://catchenlab.life.illinois.edu/stacks/manual/#files>`_

Notes: For the tags file, each stack will start in the file with a consensus sequence for the entire stack followed by the flags for that stack. Then, each individual read that was merged into that stack will follow. The next stack will start with another consensus sequence.


- XXX.snps.tsv file:

See `Stacks output description <http://catchenlab.life.illinois.edu/stacks/manual/#files>`_

Notes: If a stack has two SNPs called within it, then there will be two lines in this file listing each one.


- XXX.alleles.tsv file:

See `Stacks output description <http://catchenlab.life.illinois.edu/stacks/manual/#files>`_

@STACKS_INFOS@
]]>
    </help>
    <expand macro="citation" />
</tool>