view macros.xml @ 2:9a01840eac52 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cat commit 6b978e61a7f66160f2577d907f52dd641f103986-dirty
author jjohnson
date Mon, 25 Nov 2019 15:09:24 -0500
parents ad7507073c3f
children 18ece3d5bcde
line wrap: on
line source

<macros>
    <token name="@VERSION@">5.0.3</token>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@VERSION@">cat</requirement>
            <yield/>
        </requirements>
    </xml>
    <xml name="version_command">
        <version_command>CAT --version</version_command>
    </xml>
    <token name="@DATABASE_FOLDER@">CAT_database</token>
    <token name="@TAXONOMY_FOLDER@">taxonomy</token>
    <xml name="cat_db">
        <conditional name="db">
            <param name="db_src" type="select" label="CAT database from">
                <option value="cached">local cached database</option>
                <option value="history">history</option>
            </param>
            <when value="cached">
                <param name="cat_builtin" type="select" label="Use a built-in CAT database" help="If the CAT database of interest is not listed, contact your Galaxy administrator">
                    <options from_data_table="cat_databases">
                        <filter type="sort_by" column="2" />
                        <validator type="no_options" message="No CAT database is available." />
                    </options>
                </param>
            </when>
            <when value="history">
                <param name="cat_db" type="data" format="txt" label="A history dataset from CAT prepare tool"/>
            </when>
        </conditional>
    </xml>
    <token name="@CAT_DB@"><![CDATA[
        #if $db.db_src == 'cached':
        --database_folder $db.cat_builtin.fields.database_folder
        --taxonomy_folder $db.cat_builtin.fields.taxonomy_folder
        #else
        #import os.path
        #set $catdb = $db.cat_db.extra_files_path
        --database_folder '$os.path.join($catdb,"@DATABASE_FOLDER@")'
        --taxonomy_folder '$os.path.join($catdb,"@TAXONOMY_FOLDER@")'
        #end if
]]></token>
    <token name="@CAT_TAXONOMY@"><![CDATA[
        #if $db.db_src == 'cached':
        --taxonomy_folder $db.cat_builtin.fields.taxonomy_folder
        #else
        #import os.path
        #set $catdb = $db.cat_db.extra_files_path
        --taxonomy_folder '$os.path.join($catdb,"@TAXONOMY_FOLDER@")'
        #end if
]]></token>
    <xml name="test_catdb">
        <conditional name="db">
            <param name="db_src" value="cached"/>
            <param name="cat_builtin" value="CAT_prepare_test"/>
        </conditional>
    </xml>

    <xml name="use_intermediates">
        <conditional name="previous">
            <param name="use_previous" type="select" label="Use previous gene prediction and diamond alignment">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </param>
            <when value="no"/>
            <when value="yes">
                <param argument="--proteins_fasta" type="data" format="fasta" label="predicted proteins fasta"/>
                <param argument="--diamond_alignment" type="data" format="fasta" label="alignments file"/>
            </when>
        </conditional>
    </xml>
    <token name="@USE_INTERMEDIATES@"><![CDATA[
      #if $previous.use_previous == 'yes'
      --proteins_fasta '$previous.proteins_fasta'
      --diamond_alignment '$previous.diamond_alignment'
      #end if
      --out_prefix 'cat_output'
]]></token>

    <xml name="custom_settings">
        <param argument="--range" type="integer" value="10" min="0" max="49" label="range"/>
        <param argument="--fraction" type="float" value="0.5" min="0" max="0.99" label="fraction"/>
    </xml>
    <token name="@CUSTOM_SETTINGS@"><![CDATA[
      --range $range
      --fraction $fraction
]]></token>
    <xml name="add_names_options">
        <param argument="--only_official" type="boolean" truevalue="--only_official" falsevalue="" checked="true" 
            label="Only output official level names."/>
        <param argument="--exclude_scores" type="boolean" truevalue="--exclude_scores" falsevalue="" checked="false" 
            label="Exclude bit-score support scores in the lineage."/>
    </xml>
    <token name="@ADD_NAMES_OPTIONS@"><![CDATA[
    $only_official $exclude_scores 
]]></token>
    <xml name="add_names">
        <conditional name="names">
            <param name="add_names" type="select" label="add_names">
                <option value="no">No</option>
                <option value="orf2lca">ORF2LCA.txt</option>
                <option value="classification">classification.txt</option>
                <option value="both">ORF2LCA.txt and classification.txt</option>
            </param>
            <when value="no"/>
            <when value="orf2lca">
                <expand macro="add_names_options"/>
            </when>
            <when value="classification">
                <expand macro="add_names_options"/>
            </when>
            <when value="both">
                <expand macro="add_names_options"/>
            </when>
        </conditional>
    </xml>
    <token name="@ADD_NAMES@"><![CDATA[
    #if $names.add_names in ['classification','both']:
        && CAT add_names $names.only_official $names.exclude_scores 
            @CAT_TAXONOMY@
            #if $bcat == 'CAT'
                -i cat_output.contig2classification.tsv
            #else
                -i cat_output.bin2classification.tsv
            #end if
            -o classification_names.txt
        && @TXT2TSV@ -i classification_names.txt -o $classification_names
    #end if
    #if $names.add_names in ['orf2lca','both']:
        && CAT add_names $names.only_official $names.exclude_scores 
            @CAT_TAXONOMY@
            -i cat_output.ORF2LCA.tsv 
            -o orf2lca_names.txt
        && @TXT2TSV@ -i orf2lca_names.txt -o $orf2lca_names
    #end if
]]></token>
    <xml name="summarise">
        <param name="summarise" type="select" label="summarise">
            <option value="no">No</option>
            <option value="classification">classification.txt</option>
        </param>
    </xml>
    <token name="@SUMMARISE@"><![CDATA[
    #if $summarise in ['classification']:
        #if $names.add_names in ['classification','both'] and $names.only_official: 
            #set $summary_input = $classification_names
        #else 
            #set $summary_input = 'classification_offical_names'
            && CAT add_names --only_official
                @CAT_TAXONOMY@
                #if $bcat == 'CAT'
                    -i cat_output.contig2classification.tsv
                #else
                    -i cat_output.bin2classification.tsv
                #end if
                -o $summary_input
        #end if
        && CAT summarise 
            #if $bcat == 'CAT'
                -c $contigs_fasta
            #end if
            -i $summary_input
            -o classification_summary.txt
        && @TXT2TSV@ -i classification_summary.txt -o $classification_summary
    #end if
]]></token>
    
    <xml name="select_outputs">
        <param name="select_outputs" type="select" multiple="true" optional="false" label="Select outputs">
            <option value="log" selected="true">log</option>
            <option value="predicted_proteins_faa" selected="true">predicted_proteins.faa</option>
            <option value="predicted_proteins_gff">predicted_proteins.gff</option>
            <option value="alignment_diamond">alignment.diamond</option>
            <option value="orf2lca" selected="true">ORF2LCA.txt</option>
            <yield/>
        </param>
    </xml>
    <xml name="select_cat_outputs">
        <param name="bcat" type="hidden" value="CAT"/>
        <param name="seqtype" type="hidden" value="contig"/>
        <param name="sum_titles" type="hidden" value="contigs,number of ORFs,number of positions"/>
        <param name="bin_col" type="hidden" value=""/>
        <expand macro="select_outputs">
            <option value="contig2classification" selected="true">contig2classification.txt</option>
        </expand>
    </xml>
    <xml name="select_bat_outputs">
        <param name="bcat" type="hidden" value="BAT"/>
        <param name="seqtype" type="hidden" value="bin"/>
        <param name="sum_titles" type="hidden" value="bins"/>
        <param name="bin_col" type="hidden" value="bin,"/>
        <expand macro="select_outputs">
            <option value="bin2classification" selected="true">bin2classification.txt</option>
        </expand>
    </xml>
    
    <token name="@TXT2TSV@"><![CDATA[
    $__tool_directory__/tabpad.py 
]]></token>
    <xml name="outputs">
        <data name="log" format="txt" label="${bcat}.log" from_work_dir="cat_output.log">
            <filter>'log' in select_outputs or not select_outputs</filter>
        </data>
        <data name="predicted_proteins_faa" format="fasta" label="${bcat}.predicted_proteins.faa" from_work_dir="cat_output.predicted_proteins.faa">
            <filter>'predicted_proteins_faa' in select_outputs</filter>
        </data>
        <data name="predicted_proteins_gff" format="gff" label="${bcat}.predicted_proteins.gff" from_work_dir="cat_output.predicted_proteins.gff">
            <filter>'predicted_proteins_gff' in select_outputs</filter>
        </data>
        <data name="alignment_diamond" format="tabular" label="${bcat}.alignment.diamond" from_work_dir="cat_output.alignment.diamond">
            <filter>'alignment_diamond' in select_outputs</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="qseqid,sseqid,pident,length,mismatch,gapopen,qstart,qend,sstart,send,evalue,bitscore" />
            </actions>
        </data>
        <data name="orf2lca" format="tabular" label="${bcat}.ORF2LCA.txt" from_work_dir="cat_output.ORF2LCA.tsv">
            <filter>'orf2lca' in select_outputs</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="ORF,${bin_col}lineage,bit-score" />
            </actions>
        </data>
        <data name="contig2classification" format="tabular" label="${bcat}.contig2classification.txt" from_work_dir="cat_output.contig2classification.tsv">
            <filter>'contig2classification' in select_outputs</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="contig,classification,reason,lineage,lineage scores" />
            </actions>
        </data>
        <data name="bin2classification" format="tabular" label="${bcat}.bin2classification.txt" from_work_dir="cat_output.bin2classification.tsv">
            <filter>'bin2classification' in select_outputs</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="bin,classification,reason,lineage,lineage scores" />
            </actions>
        </data>
        <data name="orf2lca_names" format="tabular" label="${bcat}.ORF2LCA.names.txt">
            <filter>names['add_names'] in ['both','orf2lca']</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="ORF,${bin_col}lineage,bit-score,superkingdom,phylum,class,order,family,genus,species" />
            </actions>
        </data>
        <data name="classification_names" format="tabular" label="${bcat}.${seqtype}2classification.names.txt">
            <filter>names['add_names'] in ['both','classification']</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="1" />
                <action name="column_names" type="metadata" default="${seqtype},classification,reason,lineage,lineage scores,superkingdom,phylum,class,order,family,genus,species" />
            </actions>
        </data>
        <data name="classification_summary" format="tabular" label="${bcat}.${seqtype}2classification.summary.txt">
            <filter>'classification' in summarise</filter>
            <actions>
                <action name="comment_lines" type="metadata" default="4" />
                <action name="column_names" type="metadata" default="rank,clade,number of ${sum_titles}" />
            </actions>
        </data>
    </xml>
    <token name="@COMMON_HELP@"><![CDATA[
The CAT/BAT workflow is described at: https://github.com/dutilh/CAT    
]]></token>
    <xml name="citations">
        <citations>
            <citation type="doi">https://doi.org/10.1101/072868</citation>
            <citation type="doi">https://doi.org/10.1186/s13059-019-1817-x</citation>
            <yield />
        </citations>
    </xml>
</macros>