view hubArchiveCreator.xml @ 15:2a45cd656e8e draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit f11032a9df62c79a46f6e4a055a3c7ae981ea721
author rmarenco
date Fri, 02 Sep 2016 15:41:51 -0400
parents cbd8982c9f51
children 3233451a3bd6
line wrap: on
line source

<tool id="hubArchiveCreator" name="Hub Archive Creator" version="2.3.0">
    <description>
        This Galaxy tool permits to prepare your files to be ready for
        Assembly Hub visualization.
    </description>

    <requirements>
        <!-- Conda dependencies -->
        <requirement type="package" version="332">ucsc-bedtobigbed</requirement>
        <requirement type="package" version="332">ucsc-fatotwobit</requirement>
        <requirement type="package" version="332">ucsc-genepredtobed</requirement>
        <requirement type="package" version="332">ucsc-genepredtobiggenepred</requirement>
        <requirement type="package" version="332">ucsc-gff3togenepred</requirement>
        <requirement type="package" version="332">ucsc-gtftogenepred</requirement>
        <requirement type="package" version="332">ucsc-twobitinfo</requirement>
        <requirement type="package" version="1.3">samtools</requirement>
        <!-- ToolShed dependencies -->
        <requirement type="package" version="312">ucsc_tools</requirement>
        <requirement type="package" version="0.0.1">gff3ToGenePred</requirement>
        <requirement type="package" version="0.0.1">gtfToGenePred</requirement>
        <requirement type="package" version="0.0.1">genePredToBed</requirement>
        <requirement type="package" version="0.0.1">genePredToBigGenePred</requirement>
        <requirement type="package" version="1.2">samtools</requirement>
    </requirements>

    <stdio>
        <regex match="^pass1"
               source="stderr"
               level="log"
               description="bedToBigBed"/>
        <!-- TODO: Add the case pass1 and 0 chroms -->
        <!-- TODO: Add the case pass2 and 0 records or 0 fields -->
    </stdio>

    <!-- Idea: python \ -augustus [parameters] \ -trfBig [parameters] -->
    <command detect_errors="exit_code"><![CDATA[
        mkdir -p $output.extra_files_path;
        python $__tool_directory__/hubArchiveCreator.py

        ## Ask the user to enter the genome name
        --genome_name '$genome_name'

        #import json

        #set global data_parameter_dict = {}

        ## Function to retrieve the data of the inputs
        #def prepare_json($input_to_prepare, $order_index, $extra_data_dict={})
            #set false_path = str($input_to_prepare)
            #set name = $input_to_prepare.name

            #set data_dict = {"name": $name}
            #silent data_dict.update($extra_data_dict)

            ## Add the ordering by taking the tool form indexes
            #silent $data_dict.update({"order_index": $order_index + 1})

            #silent $data_parameter_dict.update({$false_path: $data_dict})

        #end def

        #for $i, $f in enumerate( $format )
            #if $f.formatChoice.format_select == "bam"
                --bam $f.formatChoice.BAM
                #set bam_index = $f.formatChoice.BAM.metadata.bam_index
                #silent $prepare_json($f.formatChoice.BAM, $i, {"index": $bam_index})
            #end if
            #if $f.formatChoice.format_select == "bed"
                #if $f.formatChoice.bedChoice.bed_select == "bed"
                    --bed $f.formatChoice.bedChoice.BED
                    #silent $prepare_json($f.formatChoice.bedChoice.BED, $i)
                #end if
                #if $f.formatChoice.bedChoice.bed_select == "bed_simple_repeats_option"
                    --bedSimpleRepeats $f.formatChoice.bedChoice.BED_simple_repeats
                    #silent $prepare_json($f.formatChoice.bedChoice.BED_simple_repeats, $i)
                #end if
            #end if
            #if $f.formatChoice.format_select == "bigwig"
                --bigwig $f.formatChoice.BIGWIG
                #silent $prepare_json($f.formatChoice.BIGWIG, $i)
            #end if
            #if $f.formatChoice.format_select == "gff3"
                --gff3 $f.formatChoice.GFF3
                #silent $prepare_json($f.formatChoice.GFF3, $i)
            #end if
            #if $f.formatChoice.format_select == "gtf"
                ## Add also GTF from Agustus? See https://github.com/ENCODE-DCC/kentUtils/issues/8
                --gtf $f.formatChoice.GTF
                #silent $prepare_json($f.formatChoice.GTF, $i)
            #end if
        #end for

        ## We combine the fasta file dataset name with his false path in a JSON object
        #set fasta_json = json.dumps({"false_path": str($fasta_file), "name": $fasta_file.name})
        -f '$fasta_json'

        ## Dump the final json
        #set all_data_json = json.dumps($data_parameter_dict)

        --data_json '$all_data_json'

        ## Retrieve the user email
        --user_email $__user_email__

        -d $__tool_directory__

        -e $output.files_path

        $advanced_options.debug_mode

        -o $output;
    ]]></command>

    <inputs>
        <param
                name="genome_name"
                type="text"
                size="30"
                value="unknown"
                label="UCSC Genome Browser assembly ID"
        />
        <param
                format="fasta"
                name="fasta_file"
                type="data"
                label="Reference genome"
        />
        <repeat name="format" title="Formats">
            <conditional name="formatChoice">
                <param name="format_select" type="select" label="Format">
                    <option value="bam" selected="true">BAM</option>
                    <option value="bed">BED</option>
                    <option value="bigwig">BIGWIG</option>
                    <option value="gff3">GFF3</option>
                    <option value="gtf">GTF</option>
                </param>

                <when value="bam">
                    <param
                            format="bam"
                            name="BAM"
                            type="data"
                            label="BAM File"
                    />
                </when>
                <when value="bigwig">
                    <param
                            format="bigwig"
                            name="BIGWIG"
                            type="data"
                            label="BIGWIG File"
                    />
                </when>
                <when value="gff3">
                    <param
                            format="gff3"
                            name="GFF3"
                            type="data"
                            label="GFF3 File"
                    />
                </when>
                <when value="gtf">
                    <param
                            format="gtf"
                            name="GTF"
                            type="data"
                            label="GTF File"
                    />
                </when>
                <when value="bed">
                    <conditional name="bedChoice">
                        <param name="bed_select" type="select" label="Bed Choice">
                            <option value="bed" selected="true">BED Generic (bed3+)</option>
                            <option value="bed_simple_repeats_option">BED Simple repeat (bed4+12 / simpleRepeat.as)</option>
                        </param>
                        <when value="bed">
                            <param
                                    format="bed"
                                    name="BED"
                                    type="data"
                                    label="Generic Bed File Choice"
                            />
                        </when>
                        <when value="bed_simple_repeats_option">
                            <param
                                    format="bed"
                                    name="BED_simple_repeats"
                                    type="data"
                                    label="Bed Simple Repeats (Bed4+12) File"
                            />
                        </when>
                    </conditional>
                </when>
            </conditional>
        </repeat>
        <conditional name="advanced_options">
            <param name="advanced_options_selector" type="select" label="Advanced options">
                <option value="off" selected="true">Hide advanced options</option>
                <option value="on">Display advanced options</option>
            </param>
            <!-- TODO: Avoid redundancy here -->
            <when value="on">
                <param name="debug_mode" type="boolean"
                       label="Activate debug mode" checked="false"
                       truevalue="--debug_mode" falsevalue="">
                    <help>
                        Use this option if you are a G-OnRamp developer
                    </help>
                </param>
            </when>
            <when value="off">
                <param name="debug_mode" type="hidden"
                       value="">
                </param>
            </when>
    </conditional>
</inputs>

    <outputs>
        <data format="trackhub" name="output"/>
    </outputs>

    <tests>
        <!-- Can also use assert_command to test command -->
        <!-- Testing GFF3 input -->
        <test>
            <param name="fasta_file" value="dbia3.fa"/>
            <repeat name="format">
                <conditional name="formatChoice">
                    <param name="format_select" value="gff3"/>
                    <param name="GFF3" value="augustusDbia3.gff3"/>
                </conditional>
            </repeat>
            <repeat name="format">
                <param name="BED_simple_repeats" value="dbia3_trfBig_unsorted.bed"/>
                <!-- TODO: Ask why the tests are not passing with this xml:
                     Error creating a job for these tool inputs - Error executing tool: 'NoneType' object has no attribute 'current_history'
                <conditional name="formatChoice">
                    <param name="format_select" value="bed"/>
                    <conditional name="bedChoice">
                        <param name="bed_select" value="bed_simple_repeats_option"/>
                        <param name="BED_simple_repeats" value="dbia3_trfBig_unsorted.bed"/>
                    </conditional>
                </conditional>
                -->
            </repeat>

            <output name="output">
                <assert_contents>
                    <has_text text="myHub"/>
                </assert_contents>
                <assert_contents>
                    <has_text text="dbia3_trfBig.bb"/>
                </assert_contents>
                <assert_contents>
                    <has_text text="SAODOAii qwwqod92921"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="fasta_file" value="dbia3.fa"/>
            <param name="GFF3" value="augustusDbia3.gff3"/>
            <output name="output" file="augustusOutput.html" lines_diff="2">
                <extra_files type="directory" value="myHub"/>
                <extra_files type="file" name="myHub/dbia3/tracks/augustusDbia3.bb" value="augustusDbia3.bb"/>
            </output>
        </test>
        <!-- Testing Generic BED input -->
        <!-- Testing Bed Simple repeat input -->
    </tests>

    <help>
        This Galaxy tool permits to prepare your files to be ready for
        Assembly Hub visualization.
    </help>
</tool>