view stacks_tsv2bam.xml @ 6:95351dd0fd3f draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/stacks2 commit 2f4c9bfc48d63075ae18a1687e8d01ffea509084
author iuc
date Wed, 11 May 2022 06:47:07 +0000
parents a4b4bd84f69e
children
line wrap: on
line source

<tool id="stacks2_tsv2bam" name="Stacks2: tsv2bam" profile="@PROFILE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>Sort reads by RAD locus</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <requirement type="package" version="1.13">samtools</requirement>
    </expand>
    <expand macro="version_cmd"/>
    <command detect_errors="aggressive"><![CDATA[
@FASTQ_INPUT_FUNCTIONS@

mkdir stacks_inputs stacks_outputs &&

#if $output_log
    ln -s '$output_log' stacks_inputs/tsv2bam.log &&
#end if

@LINK_STACKS_INPUT@
@LINK_CAT_INPUT@
@LINK_MATCHES_INPUT@

## link fastq files into stacks_inputs/
#set $paired_reads=False
#for $sample in $input_type.fqinputs:
    #if not $sample:
        #continue
    #end if
    #set $paired_reads=True
    #set ($link_cmd, $data_path, $name, $inputype) = $fastq_input_foo($sample, "reverse", ".2")
    $link_cmd
#end for

tsv2bam
-P stacks_inputs
#if $popmap
    -M '$popmap'
#else
    #for $sample in $samples
        -s '$sample'
    #end for
#end if
#if $paired_reads
    --pe-reads-dir stacks_inputs
#end if
-t \${GALAXY_SLOTS:-1}
## tsv2bam writes to stdout and creates a log file
## - make stdout stderr
## - move the additional log file
2>&1

&& mv stacks_inputs/*matches.bam stacks_outputs

## see comment in gstacks
&& for b in stacks_outputs/*matches.bam; do (samtools view -b "\$b" || true) 2> /dev/null > tmp && mv tmp "\$b"; done
]]></command>

    <inputs>
        <expand macro="input_stacks_macro"/>
        <expand macro="input_cat_macro"/>
        <expand macro="input_matches_macro"/>
        <!-- TODO add BAM? -->
        <expand macro="fastq_input" fastq_optional="true"  multiple="true" listtype="list:paired" se_option="reverse reads" help="Paired end data or reverse reads. If a paired list is provided only the reverse reads are used in tsv2bam. Leave selection empty if you analyse single end data."/>
        <param name="popmap" type="data" format="tabular,txt" label="Population map" help="If set, matching will be done only for samples listed in this file" optional="true" argument="-M"/>
        <expand macro="in_log"/>
    </inputs>

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

    <tests>
       <!-- test wo paired end data (this is not the default used in denovomap .. which is used for generating the test data therefore we only test if a list of two bams is generated) -->
       <test expect_num_outputs="2">
            <param name="input_cat">
                <collection type="list">
                    <element name="catalog.alleles" ftype="tabular" value="cstacks/catalog.alleles.tsv"/>
                    <element name="catalog.snps" ftype="tabular" value="cstacks/catalog.snps.tsv"/>
                    <element name="catalog.tags" ftype="tabular" value="cstacks/catalog.tags.tsv"/>
               </collection>
            </param>
            <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="input_matches">
                <collection type="list">
                    <element name="PopA_01.matches" ftype="tabular" value="sstacks/PopA_01.matches.tsv"/>
                    <element name="PopA_02.matches" ftype="tabular" value="sstacks/PopA_02.matches.tsv"/>
               </collection>
            </param>
            <param name="add_log" value="yes"/>
            <output name="output_log" ftype="txt" file="tsv2bam/tsv2bam.log" lines_diff="14"/>
            <output_collection name="bams" type="list" count="2"/>
        </test>
        <!-- test w popmap, w reverse reads as multiple selection -->
       <test expect_num_outputs="2">
            <param name="input_cat">
                <collection type="list">
                    <element name="catalog.alleles" ftype="tabular" value="cstacks/catalog.alleles.tsv"/>
                    <element name="catalog.snps" ftype="tabular" value="cstacks/catalog.snps.tsv"/>
                    <element name="catalog.tags" ftype="tabular" value="cstacks/catalog.tags.tsv"/>
               </collection>
            </param>
            <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="input_matches">
                <collection type="list">
                    <element name="PopA_01.matches" ftype="tabular" value="sstacks/PopA_01.matches.tsv"/>
                    <element name="PopA_02.matches" ftype="tabular" value="sstacks/PopA_02.matches.tsv"/>
               </collection>
            </param>
            <param name="popmap" ftype="tabular" value="denovo_map/popmap_cstacks.tsv"/>
            <param name="input_type|input_type_select" value="single"/>
            <param name="input_type|fqinputs" value="demultiplexed/PopA_01.2.fq,demultiplexed/PopA_02.2.fq" ftype="fastqsanger"/>
            <param name="add_log" value="yes"/>
            <output name="output_log"><assert_contents><has_text text="done."/></assert_contents></output>
            <output_collection name="bams" type="list" count="2"/>
        </test>
        <!-- test w popmap, w reverse reads as multiple selection -->
       <test expect_num_outputs="2">
            <param name="input_cat">
                <collection type="list">
                    <element name="catalog.alleles" ftype="tabular" value="cstacks/catalog.alleles.tsv"/>
                    <element name="catalog.snps" ftype="tabular" value="cstacks/catalog.snps.tsv"/>
                    <element name="catalog.tags" ftype="tabular" value="cstacks/catalog.tags.tsv"/>
               </collection>
            </param>
            <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="input_matches">
                <collection type="list">
                    <element name="PopA_01.matches" ftype="tabular" value="sstacks/PopA_01.matches.tsv"/>
                    <element name="PopA_02.matches" ftype="tabular" value="sstacks/PopA_02.matches.tsv"/>
               </collection>
            </param>
            <param name="popmap" ftype="tabular" value="denovo_map/popmap_cstacks.tsv"/>
            <param name="input_type|input_type_select" value="single"/>
            <param name="input_type|fqinputs" value="demultiplexed/PopA_01.2.fq,demultiplexed/PopA_02.2.fq" ftype="fastqsanger"/>
            <param name="add_log" value="yes"/>
            <output name="output_log"><assert_contents><has_text text="done."/></assert_contents></output>
            <output_collection name="bams" type="list" count="2"/>
        </test>
        <!-- test w reverse reads as list -->
       <test expect_num_outputs="2">
            <param name="input_cat">
                <collection type="list">
                    <element name="catalog.alleles" ftype="tabular" value="cstacks/catalog.alleles.tsv"/>
                    <element name="catalog.snps" ftype="tabular" value="cstacks/catalog.snps.tsv"/>
                    <element name="catalog.tags" ftype="tabular" value="cstacks/catalog.tags.tsv"/>
               </collection>
            </param>
            <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="input_matches">
                <collection type="list">
                    <element name="PopA_01.matches" ftype="tabular" value="sstacks/PopA_01.matches.tsv"/>
                    <element name="PopA_02.matches" ftype="tabular" value="sstacks/PopA_02.matches.tsv"/>
               </collection>
            </param>
            <param name="input_type|input_type_select" value="paired"/>
            <param name="input_type|fqinputs">
                <collection type="list">
                    <element name="PopA_01" value="demultiplexed/PopA_01.2.fq" ftype="fastqsanger"/>
                    <element name="PopA_02" value="demultiplexed/PopA_02.2.fq" ftype="fastqsanger"/>
                </collection>
            </param>
            <param name="add_log" value="yes"/>
            <output name="output_log"><assert_contents><has_text text="done."/></assert_contents></output>
            <output_collection name="bams" type="list" count="2"/>
        </test>
        <!-- test w paired reads as paired dataset list -->
       <test expect_num_outputs="2">
            <param name="input_cat">
                <collection type="list">
                    <element name="catalog.alleles" ftype="tabular" value="cstacks/catalog.alleles.tsv"/>
                    <element name="catalog.snps" ftype="tabular" value="cstacks/catalog.snps.tsv"/>
                    <element name="catalog.tags" ftype="tabular" value="cstacks/catalog.tags.tsv"/>
               </collection>
            </param>
            <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="input_matches">
                <collection type="list">
                    <element name="PopA_01.matches" ftype="tabular" value="sstacks/PopA_01.matches.tsv"/>
                    <element name="PopA_02.matches" ftype="tabular" value="sstacks/PopA_02.matches.tsv"/>
               </collection>
            </param>
            <param name="input_type|input_type_select" value="paired"/>
            <param name="input_type|fqinputs">
                <collection type="list:paired">
                    <element name="PopA_01">
                        <collection type="paired">
                            <element name="forward" value="demultiplexed/PopA_01.1.fq" ftype="fastqsanger"/>
                            <element name="reverse" value="demultiplexed/PopA_01.2.fq" ftype="fastqsanger"/>
                        </collection>
                    </element>
                    <element name="PopA_02">
                        <collection type="paired">
                            <element name="forward" value="demultiplexed/PopA_02.1.fq" ftype="fastqsanger"/>
                            <element name="reverse" value="demultiplexed/PopA_02.2.fq" ftype="fastqsanger"/>
                        </collection>
                    </element>
                </collection>
            </param>
            <param name="add_log" value="yes"/>
            <output name="output_log"><assert_contents><has_text text="done."/></assert_contents></output>
            <output_collection name="bams" type="list" count="2"/>
        </test>
    </tests>

    <help>
<![CDATA[
.. class:: infomark

**What it does**

The unique stacks program will take as input a set of short-read sequences and align them into exactly-matching stacks. Comparing the stacks it will form a set of loci and detect SNPs at each locus using a maximum likelihood framework

--------

**Input files**

FASTQ, FASTA

**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>