view reference.xml @ 2:0c3db8ec44b0 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cnvkit commit e927b17a345b18c1b51dc1b112db5129278dcd22
author iuc
date Fri, 29 Sep 2023 15:41:46 +0000
parents 83470ecad188
children
line wrap: on
line source

<tool id="cnvkit_reference" name="CNVkit Reference" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
    <description>Compile a copy-number reference from the given files or directory containing normal samples</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="xrefs"/>
    <expand macro="creators"/>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[  
        #import re
        #if str($CNV_reference.CNV_reference_availabel) == "yes"
            #set $names = []
            #set $x=1
            #for $x, $input in enumerate($CNV_reference.input_cnn_file):
                #set $name_base = re.sub('[^\w\-_\.]', '_', $input.element_identifier)
                #set $name = $name_base
                #silent $names.append( $name )
                ln -s '$input' ${name}.cnn  &&
            #end for
        #end if
        #if str($CNV_reference.CNV_reference_availabel) == "no"
            #if $CNV_reference.antitargets
                ln -s '$CNV_reference.antitargets' ./antitargets.bed &&
            #end if 
            ln -s '$CNV_reference.targets' ./targets.bed &&
        #end if
        #if $CNV_reference.advanced_settings.reference_source.fasta
            #if str($CNV_reference.advanced_settings.reference_source.ref_selector) == 'history':
                ln -s '$CNV_reference.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 '$CNV_reference.advanced_settings.reference_source.fasta.fields.path' ./genome.fa &&
                ln -s '${CNV_reference.advanced_settings.reference_source.fasta.fields.path}.fai' ./genome.fa.fai &&
            #end if
        #end if
        cnvkit.py reference
            #if str($CNV_reference.CNV_reference_availabel) == "yes"
                #for $name in $names:
                    ${name}.cnn
                #end for
            #end if
            --output ref-tas.cnn
            $CNV_reference.advanced_settings.cluster
            #if str($CNV_reference.advanced_settings.min_cluster_size)
                --min-cluster-size '$CNV_reference.advanced_settings.min_cluster_size'
            #end if
            #if str($CNV_reference.advanced_settings.Sample_sex.sex) == "yes":
                #if '$CNV_reference.advanced_settings.Sample_sex.sample_sex' == "Male"
                    #set $sample_sex_val = "Male"
                    --sample-sex '$segment_method_val'
                #else
                    --sample-sex '$CNV_reference.advanced_settings.Sample_sex.sample_sex'
                #end if
            #end if
            $CNV_reference.advanced_settings.male_reference
            #if str($CNV_reference.CNV_reference_availabel) == "no"
                --targets ./targets.bed
                #if $CNV_reference.antitargets
                    --antitargets ./antitargets.bed
                #end if
            #end if
            $CNV_reference.disable_some_of_the_bias_corrections.no_gc
            $CNV_reference.disable_some_of_the_bias_corrections.no_edge
            $CNV_reference.disable_some_of_the_bias_corrections.no_rmask
    ]]></command>
    <inputs>
        <conditional name="CNV_reference">
            <param name="CNV_reference_availabel" type="select" label="Build or reuse a copy number reference file cnn?" help="">
                <option value="no" selected="True">Build a new copy number reference file</option>
                <option value="yes">Reuse a copy number reference file</option>
            </param>
            <when value="no">
                <expand macro="construct_CNV_ref_with_natural_expected_number" />
                <section name="advanced_settings" title="Advanced settings" expanded="false">
                    <expand macro="reference_interface" />
                    <expand macro="reference_optional" /> 
                    <expand macro="sample_sex_condition" />
                </section>
                <section name="disable_some_of_the_bias_corrections" title="Bias corrections settings" expanded="false">
                    <expand macro="disable_specific_automatic_bias_corrections" />
                </section>
            </when>
            <when value="yes">
                <param name="input_cnn_file" type="data" format="tabular" multiple="true" label="Sample Target/antitarget Coverage cnn file" help="" />
                <section name="advanced_settings" title="Advanced settings" expanded="false">
                    <expand macro="reference_interface" />
                    <expand macro="reference_optional" />
                    <expand macro="sample_sex_condition" />
                </section>
                <section name="disable_some_of_the_bias_corrections" title="Bias corrections settings" expanded="false">
                    <expand macro="disable_specific_automatic_bias_corrections" />
                </section>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="out_referene_tas" format="tabular" label="${tool.name} on ${on_string}: TAS-on-target coverage" from_work_dir="ref-tas.cnn" />
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <conditional name="reference_source">
                <param name="ref_selector" value="history"/>
                <param name="fasta" ftype="fasta" value="genome.fasta" />
            </conditional>
            <param name="CNV_reference_availabel" value="yes" />
            <param name="input_cnn_file" ftype="tabular" value="tumor.targetcoverage.cnn" />
            <param name="no_gc" value="1" />
            <output name="out_referene_tas" file="ref-tas.cnn" /> 
        </test>
        <test expect_num_outputs="1">
            <conditional name="reference_source">
                <param name="ref_selector" value="cached"/>
                <param name="fasta" value="test_buildid"/>
            </conditional>
            <param name="CNV_reference_availabel" value="yes" />
            <param name="input_cnn_file" ftype="tabular" value="tumor.targetcoverage.cnn" />
            <param name="no_gc" value="1" />
            <output name="out_referene_tas" file="ref-tas.cnn" />
        </test>
        <test expect_num_outputs="1">
            <conditional name="reference_source">
                <param name="ref_selector" value="cached"/>
                <param name="fasta" value="test_buildid"/>
            </conditional>
            <param name="CNV_reference_availabel" value="yes" />
            <param name="input_cnn_file" ftype="tabular" value="tumor.targetcoverage.cnn,test.targetcoverage.cnn" />
            <param name="no_gc" value="1" />
            <output name="out_referene_tas">
                <assert_contents><has_text text="chromosome"/></assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1">
            <conditional name="reference_source">
                <param name="ref_selector" value="cached"/>
                <param name="fasta" value="test_buildid"/>
            </conditional>
            <param name="CNV_reference_availabel" value="no" />
            <param name="targets" ftype="bed" value="capture.target.bed" />
            <param name="no_gc" value="1" />
            <output name="out_referene_tas">
                <assert_contents><has_text text="chromosome"/></assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1">
            <conditional name="reference_source">
                <param name="ref_selector" value="cached"/>
                <param name="fasta" value="test_buildid"/>
            </conditional>
            <conditional name="Sample_sex">
                <param name="sex" value="no" />
            </conditional>
            <param name="CNV_reference_availabel" value="no" />
            <param name="targets" ftype="bed" value="capture.target.bed" />
            <param name="no_gc" value="1" />
            <output name="out_referene_tas">
                <assert_contents><has_text text="chromosome"/></assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
    Compile a copy-number reference from the given files or directory (containing normal samples).
    If given a reference genome (-f option), also calculate the GC content and repeat-masked
    proportion of each region.
    
    The reference .cnn file output contains those columns
    chromosome, Start, end, gene, GC content of the sequence region (gc), RepeatMasker-masked proportion
    of the sequence region (rmask), Statistical spread or dispersion (spread), Robust average of coverage
    depths (log2 ) and Robust average of absolute-scale coverage depths without any bias corrections (depth)
        
    ]]></help>
    <expand macro="citations" />
</tool>