view hal_halSnps.xml @ 2:9c83aa0e3e6a draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/haltools commit 30ac0af6dfa729277011bcd73cd5560efa03fb97
author iuc
date Wed, 18 Mar 2026 15:21:28 +0000
parents 50336dc82da7
children
line wrap: on
line source

<tool id="hal_halsnps" name="halSnps" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>counts SNPs between orthologous positions in multiple genomes</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/> 
    <expand macro="stdio"/>
    <command detect_errors="aggressive"><![CDATA[
        set -o pipefail; ## Sets the pipeline’s exit code to halSnps on failure.
        ## echo headers for specific numerical data
        echo -e "targetGenome\ttotalSnps\ttotalCleanOrthologousPairs" >> '$out_file' &&
        halSnps
            #if $mode.export == 'sequence':
                --refSequence '$mode.sequence'
            #end if
            --start $start
            --length $length
            --minSpeciesForSnp $minSpeciesForSnp
            #if $tsv:
                --tsv '$out_file_detail'
            #end if
            $noDupes
            $unique
            '$input_hal' '$refGenome' '$targetGenomes' 
            | tr ' ' '\t' ## Pipes specific output to replace space with tabs. Output is mostly numerical, and Genome names should not contain spaces
            >> '$out_file'
    ]]></command>
    <inputs>        
        <expand macro="input_hal"/> 
        <expand macro="params_refGenome"/>
        <expand macro="params_targetGenomes"/>
        <conditional name="mode">
            <param name="export" type="select" label="Process options">
                <option value="default" selected="true">Process all sequences (default)</option>
                <option value="sequence">Process a specific sequence (--refSequence)</option>
            </param>
            <when value="default"/>
            <when value="sequence">
                <expand macro="params_sequence"/>
            </when>
        </conditional>
        <expand macro="params_start"/>
        <expand macro="params_length"/>
        <param argument="--noDupes" type="boolean" truevalue="--noDupes" falsevalue="" checked="false" label="No duplicates" help="Do not consider paralogies while mapping"/>
        <param argument="--tsv" type="boolean" truevalue="--tsv" falsevalue="" checked="false" label="Detailed SNPs file" help="Create a detailed file containing base assignments for each genome at SNP locations"/>
        <param argument="--minSpeciesForSnp" type="integer" min="1" value="1" label="Minimum number of species" help="Minimum number of species that must have a different base than the reference for a SNP to be reported in the output"/>
        <param argument="--unique" type="boolean" truevalue="--unique" falsevalue="" checked="false" label="Unique" help="Whether to ignore columns that are not canonical on the reference genome"/> 
    </inputs>
    <outputs>
        <data name="out_file" format="tabular" label="${tool.name} on ${on_string}"/>
        <data name="out_file_detail" format="tabular"  label="${tool.name} on ${on_string}: Detailed SNPs file">
            <filter>tsv</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTest.hal"/>
            <param name="refGenome" value="Genome_0"/>
            <param name="targetGenomes" value="Genome_0,Genome_1,Genome_2"/>
            <output name="out_file" ftype="tabular">
                <assert_contents>
                    <has_line line="targetGenome&#009;totalSnps&#009;totalCleanOrthologousPairs"/>   
                    <has_line line="Genome_0&#009;0&#009;1758"/>    
                    <has_line line="Genome_2&#009;0&#009;586"/>
                    <has_n_lines n="4"/>
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTest.hal"/>
            <param name="refGenome" value="Genome_0"/>
            <param name="targetGenomes" value="Genome_0,Genome_1,Genome_2"/>
            <param name="noDupes" value="true"/>
            <output name="out_file" ftype="tabular">
                <assert_contents>
                    <has_line line="targetGenome&#009;totalSnps&#009;totalCleanOrthologousPairs"/>   
                    <has_line line="Genome_0&#009;0&#009;0"/>    
                    <has_line line="Genome_2&#009;0&#009;1465"/>
                    <has_n_lines n="4"/>
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTest.hal"/>
            <param name="refGenome" value="Genome_0"/>
            <param name="targetGenomes" value="Genome_0,Genome_1,Genome_2"/>
            <param name="start" value="10"/>
            <param name="length" value="50"/>
            <output name="out_file" ftype="tabular">
                <assert_contents>
                    <has_line line="targetGenome&#009;totalSnps&#009;totalCleanOrthologousPairs"/>   
                    <has_line line="Genome_0&#009;0&#009;50"/>    
                    <has_line line="Genome_2&#009;0&#009;50"/>
                    <has_n_lines n="4"/>
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1">
            <param name="input_hal" value="halTest.hal"/>
            <param name="refGenome" value="Genome_0"/>
            <param name="targetGenomes" value="Genome_0,Genome_1,Genome_2"/>
            <conditional name="mode">
                <param name="export" value="sequence"/>
                <param name="sequence" value="Genome_0_seq"/>
            </conditional>
            <param name="start" value="10"/>
            <param name="length" value="500"/>
            <output name="out_file" ftype="tabular">
                <assert_contents>
                    <has_line line="targetGenome&#009;totalSnps&#009;totalCleanOrthologousPairs"/>   
                    <has_line line="Genome_0&#009;0&#009;500"/>    
                    <has_line line="Genome_2&#009;0&#009;283"/>
                    <has_n_lines n="4"/>
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="2">
            <param name="input_hal" value="halTestExtended.hal"/>
            <param name="refGenome" value="Genome_0"/>
            <param name="targetGenomes" value="Genome_1,Insert"/>
            <param name="tsv" value="true"/>
            <output name="out_file" ftype="tabular">
                <assert_contents>
                    <has_line line="targetGenome&#009;totalSnps&#009;totalCleanOrthologousPairs"/>   
                    <has_line line="Genome_1&#009;0&#009;0"/>    
                    <has_line line="Insert&#009;32&#009;586"/>
                    <has_n_lines n="3"/>
                </assert_contents>
            </output>
            <output name="out_file_detail" ftype="tabular">
                <assert_contents>
                    <has_line line="refSequence&#009;refPosition&#009;Genome_0&#009;Genome_1&#009;Insert"/>  
                    <has_line line="Genome_0_seq&#009;10&#009;G&#009;&#009;C"/>  
                    <has_n_lines n="33"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
halSnps counts SNPs between orthologous positions across multiple genomes in a HAL alignment. 
The tool compares each position in a reference genome against one or more target genomes and reports how many SNPs occur, along with the number of clean orthologous positions examined.
    ]]></help>
    <expand macro="citation"/>
    <expand macro="creator"/>
</tool>