view dram_merge_annotations.xml @ 3:ca2c752a22e4 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dram commit 3234c3d93fa294fa9c2c5148eae4b399d42904d8
author iuc
date Fri, 23 Aug 2024 08:18:16 +0000
parents 866be6c60810
children
line wrap: on
line source

<tool id="dram_merge_annotations" name="DRAM merge multiple annotations" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@">
    <description>into a single set</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools"/>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
## DRAM expects a specific file name for each file in the set.
#set annotations_file_name = 'annotations.tsv'
#set genbank_file_name = 'genbank'
#set trnas_file_name = 'trnas.tsv'
#set rrnas_file_name = 'rrnas.tsv'
#set scaffolds_file_name = 'scaffolds.fna'
#set genes_gff_file_name = 'genes.gff'
#set genes_fna_file_name = 'genes.fna'
#set genes_faa_file_name = 'genes.faa'

## DRAM expects each annotation set to be in a different directory.
#set input_dirs = list()
#for $index, $item in enumerate($annotations_collection):
    #set dir_name = 'input_dir_' + str($index)
    mkdir '$dir_name' &&
    ln -s '$item' '$dir_name/$annotations_file_name' &&
    ln -s '$genbank_collection[$index]' '$dir_name/$genbank_file_name' &&
    #if $trnas_collection:
        ln -s '$trnas_collection[$index]' '$dir_name/$trnas_file_name' &&
    #end if
    #if $rrnas_collection
        ln -s '$rrnas_collection[$index]' '$dir_name/$rrnas_file_name' &&
    #end if
    ln -s '$scaffolds_collection[$index]' '$dir_name/$scaffolds_file_name' &&
    ln -s '$genes_gff_collection[$index]' '$dir_name/$genes_gff_file_name' &&
    ln -s '$genes_fna_collection[$index]' '$dir_name/$genes_fna_file_name' &&
    ln -s '$genes_faa_collection[$index]' '$dir_name/$genes_faa_file_name' &&
    $input_dirs.append($dir_name)
#end for

DRAM.py merge_annotations
--input_dirs 'input_dir*'
--output_dir 'output_dir'
&& (test -f 'output_dir/genes.faa' && mv 'output_dir/genes.faa' '$output_genes_faa' || echo 'No genes.faa output produced')
&& (test -f 'output_dir/genes.fna' && mv 'output_dir/genes.fna' '$output_genes_fna' || echo 'No genes.fna output produced')
&& (test -f 'output_dir/genes.gff' && mv 'output_dir/genes.gff' '$output_genes_gff' || echo 'No genes.gff output produced')
&& (test -f 'output_dir/scaffolds.fna' && mv 'output_dir/scaffolds.fna' '$output_scaffolds_fna' || echo 'No scaffolds.fna output produced')
#if $rrnas_collection:
    && (test -f 'output_dir/rrnas.tsv' && mv 'output_dir/rrnas.tsv' '$output_rrnas' || echo 'No rrnas.tsv output produced')
#end if
#if $trnas_collection:
    && (test -f 'output_dir/trnas.tsv' && mv 'output_dir/trnas.tsv' '$output_trnas' || echo 'No trnas.tsv output produced')
#end if
&& (test -f 'output_dir/annotations.tsv' && mv 'output_dir/annotations.tsv' '$output_annotations' || echo 'No annotations.tsv output produced')
    ]]></command>
    <inputs>
        <param name="annotations_collection" type="data_collection" format="tabular" collection_type="list" label="Collection of annotation files"/>
        <param name="genbank_collection" type="data_collection" format="genbank" collection_type="list" label="Collection of genbank files"/>
        <param name="trnas_collection" type="data_collection" format="tabular" collection_type="list" optional="true" label="Collection of trna files"/>
        <param name="rrnas_collection" type="data_collection" format="tabular" collection_type="list" optional="true" label="Collection of rrna files"/>
        <param name="scaffolds_collection" type="data_collection" format="fasta" collection_type="list" label="Collection of scaffolds files"/>
        <param name="genes_gff_collection" type="data_collection" format="gff3" collection_type="list" label="Collection of genes.gff files"/>
        <param name="genes_fna_collection" type="data_collection" format="fasta" collection_type="list" label="Collection of genes.fna files"/>
        <param name="genes_faa_collection" type="data_collection" format="fasta" collection_type="list" label="Collection of genes.faa files"/>
    </inputs>
    <outputs>
        <data name="output_genes_faa" format="fasta" label="${tool.name} on ${on_string}: genes.faa"/>
        <data name="output_genes_fna" format="fasta" label="${tool.name} on ${on_string}: genes.fna"/>
        <data name="output_genes_gff" format="gff3" label="${tool.name} on ${on_string}: genes.gff"/>
        <data name="output_scaffolds_fna" format="fasta" label="${tool.name} on ${on_string}: scaffolds"/>
        <data name="output_rrnas" format="tabular" label="${tool.name} on ${on_string}: rrnas">
            <filter>rrnas_collection</filter>
        </data>
        <data name="output_trnas" format="tabular" label="${tool.name} on ${on_string}: trnas">
            <filter>trnas_collection</filter>
        </data>
        <!-- DRAM just copies the genbank files to a directory -->
        <collection name="output_genbank" type="list" label="${tool.name} on ${on_string}: genbank">
            <discover_datasets pattern="__name__" ext="genbank" directory="output_dir/genbank"/>
        </collection>
        <data name="output_annotations" format="tabular" label="${tool.name} on ${on_string}: annotations"/>
    </outputs>
    <tests>
        <!--
        These tests succeed, but the outputs are empty because the DRAM
        database is not available in the test environment.
        -->
        <test expect_num_outputs="8">
            <param name="annotations_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1.tabular"/>
                    <element name="annotated2" value="annotated2.tabular"/>
                </collection>
            </param>
            <param name="genbank_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1.genbank"/>
                    <element name="annotated2" value="annotated2.genbank"/>
                </collection>
            </param>
            <param name="trnas_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1_trnas.tabular"/>
                    <element name="annotated2" value="annotated2_trnas.tabular"/>
                </collection>
            </param>
            <param name="rrnas_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1_rrnas.tabular"/>
                    <element name="annotated2" value="annotated2_rrnas.tabular"/>
                </collection>
            </param>
            <param name="scaffolds_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1_scaffold.fasta"/>
                    <element name="annotated2" value="annotated2_scaffold.fasta"/>
                </collection>
            </param>
            <param name="genes_gff_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1.gff"/>
                    <element name="annotated2" value="annotated2.gff"/>
                </collection>
            </param>
            <param name="genes_fna_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1_genes_fna.fasta"/>
                    <element name="annotated2" value="annotated2_genes_fna.fasta"/>
                </collection>
            </param>
            <param name="genes_faa_collection">
                <collection type="list">
                    <element name="annotated1" value="annotated1_genes_faa.fasta"/>
                    <element name="annotated2" value="annotated2_genes_faa.fasta"/>
                </collection>
            </param>
            <output name="output_annotations">
                <assert_contents>
                    <has_n_lines n="530" delta="1"/>
                </assert_contents>
            </output>
            <output_collection name="output_genbank" type="list" count="2">
                <element name="annotation_0.gbk" ftype="genbank">
                    <assert_contents>
                        <has_text text="LOCUS"/>
                    </assert_contents>
                </element>
                <element name="annotation_1.gbk" ftype="genbank">
                    <assert_contents>
                        <has_text text="LOCUS"/>
                    </assert_contents>
                </element>
            </output_collection>
            <output name="output_trnas">
                <assert_contents>
                    <has_n_lines n="8" delta="1"/>
                </assert_contents>
            </output>
            <output name="output_rrnas">
                <assert_contents>
                    <has_n_lines n="3" delta="1"/>
                </assert_contents>
            </output>
            <output name="output_scaffolds_fna">
                <assert_contents>
                    <has_n_lines n="4" delta="1"/>
                </assert_contents>
            </output>
            <output name="output_genes_gff">
                <assert_contents>
                    <has_n_lines n="23" delta="1"/>
                </assert_contents>
            </output>
            <output name="output_genes_fna">
                <assert_contents>
                    <has_n_lines n="26" delta="1"/>
                </assert_contents>
            </output>
            <output name="output_genes_faa">
                <assert_contents>
                    <has_n_lines n="26" delta="1"/>
                </assert_contents>
            </output>
       </test>
    </tests>
    <help>
**What it does**
 
@WHATITDOESHEADER@

This tool accepts collections of the components of a DRAM annotations (i.e., annotations, genbank files, GFF files, tRNAs,
rRNas, etc) and, except for the genbank files which remain a collection,  merges the set of files for each component into
a single file.

@WHATITDOESFOOTER@
    </help>
    <expand macro="citations"/>
</tool>