diff hubArchiveCreator.xml @ 0:0f3bc17e5ede draft

Uploaded
author rmarenco
date Wed, 13 Jul 2016 13:22:54 -0400
parents
children 915aafec8726
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hubArchiveCreator.xml	Wed Jul 13 13:22:54 2016 -0400
@@ -0,0 +1,227 @@
+<tool id="hubArchiveCreator" name="Hub Archive Creator" version="2.0.2">
+    <description>
+        This Galaxy tool permits to prepare your files to be ready for
+        Assembly Hub visualization.
+    </description>
+
+    <requirements>
+        <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="1.2">samtools</requirement>
+        <!-- Conda dependencies -->
+        <requirement type="package" version="324">ucsc-gff3togenepred</requirement>
+        <requirement type="package" version="324">ucsc-gtftogenepred</requirement>
+        <requirement type="package" version="324">ucsc-genepredtobed</requirement>
+        <requirement type="package" version="1.3.1">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
+
+        #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
+
+        ## Dump the final json
+        #set all_data_json = json.dumps($data_parameter_dict)
+
+        -f $Fasta_File
+        --data_json '$all_data_json'
+
+        -d $__tool_directory__ -e $output.files_path -o $output;
+    ]]></command>
+
+    <inputs>
+        <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">Generic BED</option>
+                            <option value="bed_simple_repeats_option">BED simple repeats</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>
+    </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>