view stacks_cstacks.xml @ 4:0345dbaaa79b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/stacks2 commit 75f83e7b16127aecc68a58df2cb75062f2a9296a"
author iuc
date Wed, 01 Sep 2021 11:30:01 +0000
parents fcce77c09289
children 0cd2df8af811
line wrap: on
line source

<tool id="stacks2_cstacks" name="Stacks2: cstacks" profile="@PROFILE@" version="@STACKS_VERSION@+galaxy@WRAPPER_VERSION@">
    <description>Generate catalog of loci</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="version_cmd"/>
    <command detect_errors="aggressive"><![CDATA[
#import re

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

@LINK_STACKS_INPUT@
cstacks

-p \${GALAXY_SLOTS:-1}

#if $popmap
    -P stacks_inputs
    -M '$popmap'
#else
    #for $sample in $samples
        -s 'stacks_inputs/$sample'
    #end for
    -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@

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

    <inputs>
        <expand macro="input_stacks_macro"/>

        <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>
        <!-- test w default options + popmap -->
        <test expect_num_outputs="2">
            <param name="input_stacks">
                <collection type="list">
                    <element name="PopA_01.alleles" ftype="tabular" value="ustacks/PopA_01.alleles.tsv"/>
                    <element name="PopA_01.snps" ftype="tabular" value="ustacks/PopA_01.snps.tsv"/>
                    <element name="PopA_01.tags" ftype="tabular" value="ustacks/PopA_01.tags.tsv"/>
                    <element name="PopA_02.alleles" ftype="tabular" value="ustacks/PopA_02.alleles.tsv"/>
                    <element name="PopA_02.snps" ftype="tabular" value="ustacks/PopA_02.snps.tsv"/>
                    <element name="PopA_02.tags" ftype="tabular" value="ustacks/PopA_02.tags.tsv"/>
               </collection>
            </param>
            <param name="popmap" ftype="tabular" value="denovo_map/popmap_cstacks.tsv"/>
            <assert_command>
                <has_text text="-M "/>
                <has_text text="--max_gaps 2.0"/>
                <has_text text="--min_aln_len 0.8"/>
            </assert_command>
            <param name="add_log" value="yes"/>
            <output name="output_log" ftype="txt" file="cstacks/cstacks.log"/>
            <!-- 1st test checks for file content allowing differences in the 2 comment lines that contain date and version -->
            <output_collection name="catalog" type="list">
                <element name="catalog.alleles" file="cstacks/catalog.alleles.tsv" ftype="tabular" lines_diff="4"/>
                <element name="catalog.snps" file="cstacks/catalog.snps.tsv" ftype="tabular" lines_diff="4"/>
                <element name="catalog.tags" file="cstacks/catalog.tags.tsv" ftype="tabular" lines_diff="4"/>
            </output_collection>
        </test>
        <!-- test w default options -->
        <test expect_num_outputs="2">
            <param name="input_stacks">
                <collection type="list">
                    <element name="PopA_01.alleles" ftype="tabular" value="ustacks/PopA_01.alleles.tsv"/>
                    <element name="PopA_01.snps" ftype="tabular" value="ustacks/PopA_01.snps.tsv"/>
                    <element name="PopA_01.tags" ftype="tabular" value="ustacks/PopA_01.tags.tsv"/>
                    <element name="PopA_02.alleles" ftype="tabular" value="ustacks/PopA_02.alleles.tsv"/>
                    <element name="PopA_02.snps" ftype="tabular" value="ustacks/PopA_02.snps.tsv"/>
                    <element name="PopA_02.tags" ftype="tabular" value="ustacks/PopA_02.tags.tsv"/>
               </collection>
            </param>
            <assert_command>
                <not_has_text text="-M "/>
                <has_text text="--max_gaps 2.0"/>
                <has_text text="--min_aln_len 0.8"/>
            </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"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
                <element name="catalog.snps"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
                <element name="catalog.tags"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
            </output_collection>
        </test>
        <!-- test w non default options (wo gapped, because tested already in ustacks) -->
        <test expect_num_outputs="1">
            <param name="input_stacks">
                <collection type="list">
                    <element name="PopA_01.alleles" ftype="tabular" value="ustacks/PopA_01.alleles.tsv"/>
                    <element name="PopA_01.snps" ftype="tabular" value="ustacks/PopA_01.snps.tsv"/>
                    <element name="PopA_01.tags" ftype="tabular" value="ustacks/PopA_01.tags.tsv"/>
                    <element name="PopA_02.alleles" ftype="tabular" value="ustacks/PopA_02.alleles.tsv"/>
                    <element name="PopA_02.snps" ftype="tabular" value="ustacks/PopA_02.snps.tsv"/>
                    <element name="PopA_02.tags" 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>
                <not_has_text text="-M "/>
                <has_text text="--k_len 23"/>
                <has_text text="-n 2"/>
                <has_text text="--report_mmatches"/>
            </assert_command>
            <param name="add_log" value="no"/>
            <assert_stderr><has_text text="done."/></assert_stderr>
            <output_collection name="catalog" type="list">
                <element name="catalog.alleles"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
                <element name="catalog.snps"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
                <element name="catalog.tags"><assert_contents><has_text text="# cstacks completed on "/></assert_contents></element>
            </output_collection>
        </test>
    </tests>
    <help>
<![CDATA[
.. class:: infomark

**What it does**

A catalog can be built from any set of samples processed by ustacks. 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 or ustacks

**Output files**

- catalog.tags 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.


- catalog.snps 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.


- catalog.alleles file:

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

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