view list_spaln_tables.xml @ 2:dd0cd2319ae5 draft

"planemo upload for repository https://github.com/ogotoh/spaln commit c06dea51e720899c3245d203c3a0abc9f179583f"
author iuc
date Fri, 19 Nov 2021 10:09:15 +0000
parents 37b5e1f0b544
children
line wrap: on
line source

<tool id="list_spaln_tables" name="List spaln parameter tables" version="@TOOL_VERSION@+galaxy0">
    <description>Given a query species, list the spaln settings tables that exist, from closest related species to most different</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <requirements>
        <requirement type="package" version="3.8">python</requirement>
        <requirement type="package" version="@TOOL_VERSION@">spaln</requirement>
        <requirement type="package" version="1.0.7">rust-ncbitaxonomy</requirement>
    </requirements>
    <command detect_errors="aggressive"><![CDATA[
        #if $gnm2tab.gnm2tab_source == "spaln_tool"
            SPALN_LOCATION=\$(dirname \$(dirname \$(which spaln))) &&
            GNM2TAB_PATH="\$SPALN_LOCATION/share/spaln/table/gnm2tab" &&
            if [[ -f "\$GNM2TAB_PATH" ]] ; then
                ln -s "\$GNM2TAB_PATH" gnm2tab ;
            else
                echo "Cannot find builtin gnm2tab file \$SPALN_LOCATION : \$GNM2TAB_PATH" >&2 ; exit 1 ;
            fi &&
        #else
            ln -s '${gnm2tab.gnm2tab_file}' gnm2tab &&
        #end if
        #if $taxonomy.taxonomy_source == "cached"
            ln -s '${taxonomy.taxonomy_sqlite_table.fields.path}/tax.ncbitaxonomy.sqlite' tax.ncbitaxonomy.sqlite &&
        #else
            ln -s '${taxonomy.taxonomy_sqlite_file}' tax.ncbitaxonomy.sqlite &&
        #end if
	    python '${__tool_directory__}/list_spaln_tables.py' --taxonomy_db tax.ncbitaxonomy.sqlite --gnm2tab_file gnm2tab '$taxon' | sort -k1n > '${output}'
    ]]></command>
    <inputs>
        <param name="taxon" label="Scientific name" type="text" />
        <conditional name="gnm2tab">
            <param name="gnm2tab_source" type="select" label="Choose source of gnm2tab file">
                <option value="spaln_tool" selected="true">From the spaln tool installation</option>
                <option value="history">From dataset in history</option>
            </param>
            <when value="spaln_tool" />
            <when value="history">
                <param name="gnm2tab_file" type="data" format="tabular" label="gnm2tab file from spaln" help="The gnm2tab file should be from the table directory of spaln v. @TOOL_VERSION@" />
            </when>
        </conditional>
        <conditional name="taxonomy">
            <param type="select" name="taxonomy_source">
                <option value="cached" selected="true">Use built-in NCBI Taxonomy SQLite database</option>
                <option value="history">Use NCBI Taxonomy SQLite database from history</option>
            </param>
            <when value="cached">
                <param type="select" name="taxonomy_sqlite_table"  label="NCBI Taxonomy SQLite database">
                    <options from_data_table="ncbi_taxonomy_sqlite">
                        <filter type="sort_by" column="1" />
                        <validator type="no_options" message="No NCBI Taxonomy SQLite database is available" />
                    </options>
                </param>
            </when>
            <when value="history">
                <param name="taxonomy_sqlite_file" type="data" format="sqlite" label="NCBI Taxonomy SQLite database" />
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="output" format="tabular">
            <actions>
                <action name="column_names" type="metadata" default="dist_all,dist_canonical,common_ancestor,species_code,settings_group,scientific_name" />
            </actions>
        </data>
    </outputs>

    <tests>
        <test>
            <param name="taxon" value="Lates calcarifer" />
            <conditional name="gnm2tab">
                <param name="gnm2tab_source" value="spaln_tool" />
            </conditional>
            <conditional name="taxonomy">
                <param name="taxonomy_source" value="history" />
                <param name="taxonomy_sqlite_file" ftype="sqlite" value="sqlite_taxdb/tax.ncbitaxonomy.sqlite" />
            </conditional>
            <output name="output">
                <assert_contents>
                    <has_line_matching expression="5\t4\tActinopteri\tcynosemi\tFish_mdl\tCynoglossus semilaevis" />
                    <has_line_matching expression="30\t7\tEukaryota\tzea_mays\tAngiosp\tZea mays" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="taxon" value="Lates calcarifer" />
            <conditional name="gnm2tab">
                <param name="gnm2tab_source" value="spaln_tool" />
            </conditional>
            <conditional name="taxonomy">
                <param name="taxonomy_source" value="cached" />
                <param name="taxonomy_sqlite_table" value="sample" />
            </conditional>
            <output name="output">
                <assert_contents>
                    <has_line_matching expression="5\t4\tActinopteri\tcynosemi\tFish_mdl\tCynoglossus semilaevis" />
                    <has_line_matching expression="30\t7\tEukaryota\tzea_mays\tAngiosp\tZea mays" />
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="taxon" value="Lates calcarifer" />
            <conditional name="gnm2tab">
                <param name="gnm2tab_source" value="history" />
                <param name="gnm2tab_file" ftype="tabular" value="gnm2tab" />
            </conditional>
            <conditional name="taxonomy">
                <param name="taxonomy_source" value="cached" />
                <param name="taxonomy_sqlite_table" value="sample" />
            </conditional>
            <output name="output">
                <assert_contents>
                    <has_line_matching expression="5\t4\tActinopteri\tcynosemi\tFish_mdl\tCynoglossus semilaevis" />
                    <has_line_matching expression="30\t7\tEukaryota\tzea_mays\tMagnolio\tZea mays" />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
        Spaln has a number of pre-computed settings files to tune its predictions for different species. These
        are listed in a file named gnm2tab_ in the package. This tool uses the NCBI Taxonomy database to search
        that able for a suitable (i.e. taxonomically close) set of settings for optimising spaln's alignment
        predictions. 
        
        Input is the scientific name of a species (as reflected in the NCBI Taxonomy DB), output is
        information from the gnm2tab file sorted by taxonomic distance from the query species.

        .. _gnm2tab: https://github.com/ogotoh/spaln/blob/master/table/gnm2tab
    ]]></help>
    <citations>
    </citations>
</tool>