view autobin.xml @ 0:fff49e30af46 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cnvkit commit c35b83e4b65b211377c9f616c77d7306da48a984
author iuc
date Sun, 14 May 2023 20:09:40 +0000
parents
children 94e1d19c8190
line wrap: on
line source

<tool id="cnvkit_autobin" name="CNVkit Autobin" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
    <description>Estimates read counts or depths in a BAM file</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="xrefs"/>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[  
        #import re
        #set $names = []
        #set $x=1
        #for $x, $bam in enumerate($bams):
            #set $name_base = re.sub('[^\w\-_\.]', '_', $bam.element_identifier)
            #set $name = $name_base + '_' + str(x)
            #silent $names.append( $name )
            ln -s '$bam' ${name}.bam  &&
            ln -s '${bam.metadata.bam_index}' ${name}.bai  &&
        #end for
        ln -s '$targets' ./capture.bed &&
        #if $advanced_settings.reference_source.fasta
            #if str($advanced_settings.reference_source.ref_selector) == 'history':
                ln -s '$advanced_settings.reference_source.fasta' ./genome.fa &&
                samtools faidx ./genome.fa 2>&1 || echo 'Error running samtools faidx for indexing fasta reference for CNVkit' >&2 &&
            #else
                ln -s '$advanced_settings.reference_source.fasta.fields.path' ./genome.fa &&
                ln -s '${advanced_settings.reference_source.fasta.fields.path}.fai' ./genome.fa.fai &&
            #end if
        #end if
        #if $advanced_settings.access
            ln -s '$advanced_settings.access' ./access.bed &&
        #end if
        #if $advanced_settings.annotate
            ln -s '$advanced_settings.annotate' ./annotate.bed &&
        #end if
        #if $advanced_settings.target_output_bed
            ln -s '$advanced_settings.target_output_bed' ./target_output.bed &&
        #end if
        #if $advanced_settings.antitarget_output_bed
            ln -s '$advanced_settings.antitarget_output_bed' ./antitarget_output.bed &&
        #end if
        cnvkit.py autobin
            #for $name in $names:
                ${name}.bam
            #end for
            --targets ./capture.bed
            #if $advanced_settings.method == "hybrid"
                #set $method_val = "hybrid"
                --method '$method_val'
            #else
                --method '$method'
           #end if
           #if $advanced_settings.access
               --access ./access.bed
           #end if
           #if str($advanced_settings.bp_per_bin)
               --bp-per-bin $advanced_settings.bp_per_bin
           #end if
           #if str($advanced_settings.target_max_size)
               --target-max-size $advanced_settings.target_max_size
           #end if
           #if str($advanced_settings.target_min_size)
               --target-min-size $advanced_settings.target_min_size
           #end if
           #if str($advanced_settings.antitarget_max_size)
               --antitarget-max-size $advanced_settings.antitarget_max_size
           #end if
           #if str($advanced_settings.antitarget_min_size)
               --antitarget-min-size $advanced_settings.antitarget_min_size
           #end if
           #if $advanced_settings.annotate
               --annotate ./annotate.bed
           #end if
           $advanced_settings.short_names
           #if $advanced_settings.target_output_bed
                --target-output-bed ./target_output.bed
           #end if
           #if $advanced_settings.antitarget_output_bed
                --antitarget-output-bed ./antitarget_output.bed
           #end if
    ]]></command>
    <inputs>
        <param name="bams" type="data" multiple="true" format="bam" label="Input Sample BAM file/s" help="" />
        <param argument="--targets" type="data" format="bed,tabular" label="Input Potentially targeted genomic regions" help="e.g. all possible exons for the reference genome. Format: BED, interval list, etc." />
        <section name="advanced_settings" title="Advanced settings" expanded="false">
            <expand macro="reference_interface" />
            <expand macro="autobin_optional" />
        </section>
    </inputs>
    <outputs>
        <data name="out_capture_target" format="bed" label="${tool.name} on ${on_string}: Capture target" from_work_dir="capture.target.bed" />
        <data name="out_capture_antitarget" format="bed" label="${tool.name} on ${on_string}: Capture antitarget" from_work_dir="capture.antitarget.bed" />
    </outputs>
    <tests>
        <test expect_num_outputs="2">
            <conditional name="reference_source">
                <param name="ref_selector" value="history"/>
                <param name="fasta" ftype="fasta" value="genome.fasta" />
            </conditional>
            <param name="bams" ftype="bam" value="tumor.bam" />
            <param name="targets" ftype="bed" value="capture.bed" />
            <output name="out_capture_target" file="capture.target.bed" /> 
            <output name="out_capture_antitarget" file="capture.antitarget.bed" /> 
        </test>
        <test expect_num_outputs="2">
            <conditional name="reference_source">
                <param name="ref_selector" value="cached"/>
                <param name="fasta" value="test_buildid"/>
            </conditional>
            <param name="bams" ftype="bam" value="tumor.bam" />
            <param name="targets" ftype="bed" value="capture.bed" />
            <output name="out_capture_target" file="capture.target.bed" /> 
            <output name="out_capture_antitarget" file="capture.antitarget.bed" /> 
        </test>
        <test expect_num_outputs="2">
            <param name="bams" ftype="bam" value="tumor.bam,tumor_1.bam" />
            <param name="targets" ftype="bed" value="capture.bed" />
            <output name="out_capture_target" file="capture.target.bed" /> 
            <output name="out_capture_antitarget" file="multible_capture.antitarget.bed" /> 
        </test>
    </tests>
    <help><![CDATA[
         Quickly estimate read counts or depths in a BAM file to estimate reasonable on- and (if relevant) off-target bin sizes.
    ]]></help>
    <expand macro="citations" />
</tool>