view samtools_bam_to_cram.xml @ 8:18dbde5680c0 draft default tip

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

<tool id="samtools_bam_to_cram" name="samtools BAM to CRAM" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>convert BAM alignments to CRAM format</description>

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

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

        samtools view
            #if $parameter_regions.target_region == "regions_bed_file"
                -L '${parameter_regions.regions_bed_file}'
            #end if

            -@ \$addthreads
	    -C
	    -h
            -o '${output_alignment}'
            -T "\$reffa"
            -t "\$reffai"
            --output-fmt-option no_ref
            infile

            #if $parameter_regions.target_region == "region"
                '${parameter_regions.region_string}'
            #end if
    ]]></command>

    <inputs>
        <param name="input" type="data" format="bam,sam" label="BAM (or SAM) alignment file"/>
        <expand macro="mandatory_reference" argument="-t"/>
        <conditional name="parameter_regions">
            <param name="target_region" type="select" label="Choose conversion within specific genomic region(s)">
                <option value="entire_input_file">Entire BAM alignment file</option>
                <option value="region">Specific region</option>
                <option value="regions_bed_file">List of specific regions (BED file)</option>
            </param>
            <when value="entire_input_file" />
            <when value="region">
                <param name="region_string" type="text" label="Samtools: region in which pileup is generated" help="e.g. chrX or chr:start-end" />
            </when>
            <when value="regions_bed_file">
                <param name="regions_bed_file" argument="-L" type="data" format="bed"
                       label="Only include reads overlapping this BED file" />
            </when>
        </conditional>
    </inputs>

    <outputs>
        <data name="output_alignment" format="cram" label="$tool.name on ${on_string}.cram"></data>
    </outputs>

    <tests>
        <test>
            <param name="input" value="test.bam" ftype="bam" />
            <param name="addref_select" value="history" />
            <param name="ref" value="test.fa" />
            <param name="target_region" value="entire_input_file" />
            <output name="output_alignment" file="test_bam.cram" ftype="cram" compare="sim_size" delta="250" />
        </test>
        <test>
            <param name="input" value="test.sam" ftype="sam" />
            <param name="addref_select" value="history" />
            <param name="ref" value="test.fa" />
            <param name="target_region" value="entire_input_file" />
            <output name="output_alignment" file="test_sam.cram" ftype="cram" compare="sim_size" delta="250" />
        </test>
        <test>
            <param name="input" value="test.bam" ftype="bam" />
            <param name="addref_select" value="history" />
            <param name="ref" value="test.fa" />
            <param name="target_region" value="region" />
            <param name="region_string" value="CHROMOSOME_I" />
            <output name="output_alignment" file="test_chr1.cram" ftype="cram" compare="sim_size" delta="250" />
        </test>
        <test>
            <param name="input" value="test.bam" ftype="bam" />
            <param name="addref_select" value="history" />
            <param name="ref" value="test.fa" />
            <param name="target_region" value="regions_bed_file" />
            <param name="regions_bed_file" value="test.bed" ftype="bed" />
            <output name="output_alignment" file="test_regions.cram" ftype="cram" compare="sim_size" delta="250" />
        </test>
        <test>
            <param name="input" ftype="bam" dbkey="equCab2" value="sam_to_bam_out2.bam" />
            <param name="addref_select" value="cached" />
            <param name="ref" value="equCab2chrM" />
            <param name="target_region" value="entire_input_file" />
            <output name="output_alignment" file="test2.cram" ftype="cram" compare="sim_size" delta="250" />
        </test>
    </tests>

    <help><![CDATA[
**What this tool does**

Converts alignments from the BAM format to the CRAM format using the ``samtools view`` command.
The CRAM format does additional compression relative to the reference genome which makes the compression in terms of file size more efficient.
    ]]></help>

    <expand macro="citations" />
</tool>