view samtools_cram_to_bam.xml @ 5:634df184b2a8 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/cram_to_bam commit c5ded4208dd70e88596ddc725795a2401773f02d"
author iuc
date Sat, 27 Nov 2021 12:31:35 +0000
parents 1551b0dd2d16
children 55ae400c0cc4
line wrap: on
line source

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

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

    <command><![CDATA[
        @ADDTHREADS@
        ln -s '$input' input.cram &&
        #if str( $input.metadata.cram_index ) != "None":
            ln -f -s '${input.metadata.cram_index}' input.cram.crai &&
        #end if

        @PREPARE_FASTA_IDX@

        samtools view
            #if $parameter_regions.target_region == "regions_bed_file"
                -L '$parameter_regions.regions_bed_file'
            #end if
            -@ \$addthreads
            -b
            -T "\$reffa"
            -o '$output_alignment'
            input.cram
            #if $parameter_regions.target_region == "region"
                '$parameter_regions.region_string'
            #end if
    ]]></command>

    <inputs>
        <param name="input" type="data" format="cram" label="CRAM 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="bam" label="$tool.name on ${on_string}.bam"></data>
    </outputs>

    <tests>
        <test>
            <param name="input" value="test.cram" ftype="cram" />
            <param name="addref_select" value="history" />
            <param name="ref" value="test.fa" />
            <output name="output_alignment" file="test.bam" ftype="bam" lines_diff="4" />
        </test>
        <test>
            <param name="input" value="test.cram" ftype="cram" />
            <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.bam" ftype="bam" lines_diff="4" />
        </test>
        <test>
            <param name="input" value="test.cram" ftype="cram" />
            <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.bam" ftype="bam" lines_diff="4" />
        </test>
        <test>
            <param name="input" value="test2.cram" dbkey="equCab2" ftype="cram" />
            <param name="addref_select" value="cached" />
            <param name="ref" value="equCab2chrM" />
            <param name="target_region" value="entire_input_file" />
            <output name="output_alignment" file="sam_to_bam_out2.bam" ftype="bam" lines_diff="4" />
        </test>
    </tests>

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

Converts alignments from the CRAM format to the BAM format using the ``samtools view`` command.
    ]]></help>
    <expand macro="citations"/>
</tool>