view samtools_bam_to_cram.xml @ 3:3d07b8a6dd8c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/bam_to_cram commit 851f81495c875ac09d936537ffd2b32e6af2c8c5"
author iuc
date Thu, 17 Oct 2019 02:16:13 -0400
parents 3e15f2544a5c
children 7d3cd2087698
line wrap: on
line source

<tool id="samtools_bam_to_cram" name="samtools BAM to CRAM" version="@TOOL_VERSION@">
    <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"/>
        <conditional name="addref_cond">
            <param name="addref_select" type="select" label="Load reference genome from">
                <option value="cached">Local cache</option>
                <option value="history">History</option>
            </param>
            <when value="cached">
                <param name="ref" type="select" label="Reference genome">
                    <options from_data_table="fasta_indexes">
                        <filter type="data_meta" ref="input" key="dbkey" column="dbkey" />
                    </options>
                    <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
                </param>
            </when>
            <when value="history">
                <param name="ref" type="data" format="fasta" label="Reference FASTA file"/>
            </when>
        </conditional>
        <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.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.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.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.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" 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>