view sam_to_bam.xml @ 13:0e60e2dd20af draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/sam_to_bam commit 9c5a35ce695c3d134e41d8695487edd5f71ea33c
author iuc
date Sun, 08 Sep 2024 03:25:11 +0000
parents 9bd1568619cd
children
line wrap: on
line source

<tool id="sam_to_bam" name="SAM-to-BAM" version="2.1.2" profile="@PROFILE@">
    <description>convert SAM to BAM</description>

    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <expand macro="version_command"/>

    <command><![CDATA[
        @ADDTHREADS@
        @ADDMEMORY@
        @PREPARE_FASTA_IDX@

        samtools view
            -b
            -@ \$addthreads
            -t "\$reffai"
            '$input' |

        samtools sort
            -O bam
            -@ \$addthreads -m \$addmemory"M"
            -o '$output1'
            -T "\${TMPDIR:-.}"
    ]]></command>

    <inputs>
        <param name="input" type="data" format="sam" label="SAM file to convert"/>
        <expand macro="mandatory_reference" argument="-t"/>
    </inputs>
    <outputs>
        <data name="output1" format="bam" label="${tool.name} on ${on_string}: converted BAM">
            <actions>
                <conditional name="addref_cond.addref_select">
                    <when value="cached">
                        <action name="dbkey" type="metadata">
                            <option name="input" param_attribute="dbkey" type="from_param" />
                        </action>
                    </when>
                    <when value="history">
                        <action name="dbkey" type="metadata">
                            <option name="addref_cond.ref" param_attribute="dbkey" type="from_param" />
                        </action>
                    </when>
                </conditional>
            </actions>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="addref_select" value="history" />
            <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" />
            <param name="input" ftype="sam" value="sam_to_bam_in1.sam" />
            <output name="output1" ftype="bam" file="sam_to_bam_out1.bam" lines_diff="4"/>
        </test>
        <test>
            <param name="addref_select" value="cached" />
            <param name="ref" value="equCab2chrM" />
            <param name="input" ftype="sam" dbkey="equCab2" value="sam_to_bam_in1.sam" />
            <output name="output1" ftype="bam" file="sam_to_bam_out2.bam" lines_diff="4"/>
        </test>
        <test>
            <param name="addref_select" value="history" />
            <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" />
            <param name="input" ftype="sam" value="sam_to_bam_noheader_in2.sam" />
            <output name="output1" ftype="bam" file="sam_to_bam_out3.bam" lines_diff="4"/>
        </test>
        <test>
            <!-- Test direct use of bgzipped reference -->
            <param name="addref_select" value="history" />
            <param name="ref" ftype="fasta.gz" dbkey="equCab2" value="chr_m.bgzipped_fasta.gz" />
            <param name="input" ftype="sam" value="sam_to_bam_noheader_in2.sam" />
            <output name="output1" ftype="bam" file="sam_to_bam_out3.bam" lines_diff="4"/>
        </test>
        <test>
            <!-- Test with simple gzipped reference, which requires decompression -->
            <param name="addref_select" value="history" />
            <param name="ref" ftype="fasta.gz" dbkey="equCab2" value="chr_m.fasta.gz" />
            <param name="input" ftype="sam" value="sam_to_bam_noheader_in2.sam" />
            <output name="output1" ftype="bam" file="sam_to_bam_out3.bam" lines_diff="4"/>
        </test>
    </tests>
    <help><![CDATA[
**What it does**

Converts SAM dataset into its binary, BAM, representation using the ``samtools view`` and ``sort`` commands.
    ]]></help>
    <expand macro="citations"/>
</tool>