changeset 0:a993f4a9aeaa draft default tip

Uploaded
author brenninc
date Thu, 12 May 2016 06:20:51 -0400
parents
children
files bedToBam.xml macros.xml test-data/bedToBam1.bed test-data/bedToBam_result.bam test-data/mm9_chr1.len test-data/sortedBedToBam_result.bam tool_dependencies.xml
diffstat 7 files changed, 248 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bedToBam.xml	Thu May 12 06:20:51 2016 -0400
@@ -0,0 +1,52 @@
+<!-- adapted from https://toolshed.g2.bx.psu.edu/view/iuc/bedtools/f8b7dc21b4ee
+     Added the samtools sort and samtools requirement as bam files must be outpit sorted -->
+<tool id="bedtools_bedtobam_sorted" name="BED to sorted BAM" version="@WRAPPER_VERSION@.0">
+    <description>converter</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" >
+        <requirement type="package" version="1.2">samtools</requirement>
+    </expand>
+    <expand macro="stdio" />
+    <command>
+<![CDATA[
+        bedtools bedtobam
+        $bed12
+        -mapq $mapq
+        -g $genome
+        -i '$input'
+        > unsorted.bam  &&
+        samtools sort -@ \${GALAXY_SLOTS:-1} -o '$output' -O bam -T dataset 'unsorted.bam'
+]]>
+    </command>
+    <inputs>
+        <param format="bed" name="input" type="data" label="Convert the following BED file to BAM"/>
+        <param name="bed12" type="boolean" truevalue="-bed12" falsevalue="" checked="false"
+            label="Indicate that the input BED file is in BED12 (a.k.a 'blocked' BED) format"
+            help="If Selected, bedToBam will convert blocked BED features (e.g., gene annotaions) into 'spliced' BAM alignments by creating an appropriate CIGAR string. (-bed12)"/>
+        <expand macro="genome" />
+        <param name="mapq" type="integer" value="255"
+            label="Set a mapping quality (SAM MAPQ field) value for all BED entries" help="(-mapq)"/>
+    </inputs>
+    <outputs>
+        <data format="bam" name="output" metadata_source="input" label="${input.name} (as BAM)"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="bedToBam1.bed" ftype="bed" />
+            <param name="genome" value="mm9_chr1.len" ftype="tabular" />
+            <output name="output" file="sortedBedToBam_result.bam" lines_diff="4" ftype="bam" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+**What it does**
+
+bedToBam converts features in a feature file to BAM format. This is useful as an efficient means of storing large genome annotations in a compact, indexed format for visualization purposes.
+
+@REFERENCES@
+]]>
+    </help>
+    <expand macro="citations" />
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Thu May 12 06:20:51 2016 -0400
@@ -0,0 +1,181 @@
+<!-- copied from from https://toolshed.g2.bx.psu.edu/view/iuc/bedtools/f8b7dc21b4ee -->
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="2.24">bedtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <token name="@WRAPPER_VERSION@">2.24</token>
+    <xml name="stdio">
+        <stdio>
+            <!-- Anything other than zero is an error -->
+            <exit_code range="1:" />
+            <exit_code range=":-1" />
+            <!-- In case the return code has not been set propery check stderr too -->
+            <regex match="Error:" />
+            <regex match="Exception:" />
+        </stdio>
+        <version_command>bedtools --version</version_command>
+    </xml>
+    <xml name="reciprocal">
+        <param name="reciprocal" type="boolean" checked="false" truevalue="-r" falsevalue=""
+            label="Require that the fraction of overlap be reciprocal for A and B"
+            help="In other words, if -f is 0.90 and -r is used, this requires that B overlap at least 90% of A and that A also overlaps at least 90% of B. (-r)" />
+    </xml>
+    <xml name="overlap">
+        <param name="overlap" type="float" value="0.000000001" label="Minimum overlap required as a fraction of A" help="Default is 1E-9, i.e. 1bp. (-f)"/>
+    </xml>
+    <xml name="strand2">
+        <param name="strand" type="select" label="Calculation based on strandedness?">
+            <option value="" selected="True">Overlaps on either strand</option>
+            <option value="-s">Only overlaps occurring on the **same** strand.</option>
+            <option value="-S">Only overlaps occurring on the **opposite** strand.</option>
+        </param>
+    </xml>
+    <xml name="seed">
+        <conditional name="seed">
+            <param name="seed_choose" type="select" label="Choose Seed?" help="(-seed)">
+                <option value="False" selected="True">Random Shuffling</option>
+                <option value="True">Choose fixed seed</option>
+            </param>
+            <when value="True">
+                <param name="seed" type="integer" value="12345" label="Enter Seed" />
+            </when>
+            <when value="False" />
+        </conditional>
+    </xml>
+    <xml name="split">
+        <param name="split" type="boolean" checked="false" truevalue="-split" falsevalue=""
+            label="Treat split/spliced BAM or BED12 entries as distinct BED intervals when computing coverage."
+            help="If set, the coverage will be calculated based the spliced intervals only. For BAM files, this inspects the CIGAR N operation to infer the blocks for computing coverage. For BED12 files, this inspects the BlockCount, BlockStarts, and BlockEnds fields (i.e., columns 10,11,12). If this option is not set, coverage will be calculated based on the interval's START/END coordinates, and would include introns in the case of RNAseq data. (-split)" />
+    </xml>
+    <xml name="genome">
+        <param format="tabular" name="genome" type="data" label="Genome file" />
+        <!--TODO: make use of: ${chromInfo} -->
+    </xml>
+    <xml name="closest_D_option">
+        <param name="iu" type="boolean" checked="false" truevalue="-iu" falsevalue=""
+            label="Ignore features in B that are upstream of features in A" 
+            help="This option requires -D and follows its orientation rules for determining what is 'upstream'. (-iu)" />
+
+        <param name="id" type="boolean" checked="false" truevalue="-id" falsevalue=""
+            label="Ignore features in B that are downstream of features in A" 
+            help="This option requires -D and follows its orientation rules for determining what is 'downstream'. (-id)" />
+
+        <param name="fu" type="boolean" checked="false" truevalue="-fu" falsevalue=""
+            label="Choose first from features in B that are upstream of features in A" 
+            help="This option requires -D and follows its orientation rules for determining what is 'upstream'. (-fu)" />
+
+        <param name="fd" type="boolean" checked="false" truevalue="-fd" falsevalue=""
+            label="Choose first from features in B that are downstream of features in A" 
+            help="This option requires -D and follows its orientation rules for determining what is 'downstream'. (-fd)" />
+    </xml>
+    <xml name="addition">
+        <conditional name="addition">
+            <param name="addition_select" type="select" label="Choose what you want to do">
+                <option value="b" selected="True">Increase the BED/GFF/VCF entry by the same number base pairs in each direction.</option>
+                <option value="lr">Increase by Start Coordinate and End Coordinate</option>
+            </param>
+            <when value="b">
+                <param name="b" value="1" label="Number of base pairs" type="integer" />
+            </when>
+            <when value="lr">
+                <param name="l" type="integer" value="0" label="The number of base pairs to subtract from the start coordinate" />
+                <param name="r" type="integer" value="0" label="The number of base pairs to add to the end coordinate" />
+            </when>
+        </conditional>
+    </xml>
+    <xml name="print_header">
+        <param name="header" type="boolean" checked="False" truevalue="-header" falsevalue=""
+            label="Print the header from the A file prior to results" help="(-header)" />
+    </xml>
+    <!-- TODO this is currently not used, but we should make use of it -->
+    <xml name="genome_validator">
+        <validator type="unspecified_build" />
+        <validator type="dataset_metadata_in_data_table" table_name="fasta_indexes" metadata_name="dbkey" metadata_column="1" message="Sequences are not currently available for the specified build." />
+    </xml>
+
+    <!-- ToDo column_picker -->
+    <xml name="choose_columns">
+        <param name="cols" type="text" value=""
+            label="Specify the column(s) that should be summarized"
+            help="comma separated (-c)">
+            <sanitizer invalid_char="">
+                <valid initial="string.digits"><add value=","/></valid>
+            </sanitizer>
+        </param>
+    </xml>
+
+    <token name="@C_AND_O_ARGUMENT@">
+        #set $col = list()
+        #set $op = list()
+        #for $item in $c_and_o_argument_repeat:
+            #silent $col.append( str($item.col) )
+            #silent $op.append( str($item.operation) )
+        #end for
+        #if $col:
+            -c #echo ','.join($col)#
+            -o #echo ','.join($op)#
+        #end if
+    </token>
+
+    <xml name="c_and_o_argument">
+        <repeat name="c_and_o_argument_repeat" title="Applying operations to columns from merged intervals" min="0">
+            <yield />
+            <expand macro="choose_operations">
+                <expand macro="math_options" />
+                <expand macro="additional_math_options" />
+            </expand>
+        </repeat>
+    </xml>
+
+
+    <xml name="choose_operations">
+        <param name="operation" type="select" label="Specify the operation">
+            <yield />
+        </param>
+    </xml>
+
+    <xml name="math_options">
+        <option value="sum" selected="True">Sum - numeric only</option>
+        <option value="min">Min - numeric only</option>
+        <option value="max">Max - numeric only</option>
+        <option value="absmin">AbsMin - numeric only</option>
+        <option value="absmax">AbsMax - numeric only</option>
+        <option value="mean">Mean - numeric only</option>
+        <option value="median">Median - numeric only</option>
+        <option value="mode">Mode - numeric only</option>
+        <option value="antimode">Antimode - numeric only</option>
+        <option value="collapse">collapse (i.e., print a comma separated list) - numeric or text</option>
+    </xml>
+    <xml name="additional_math_options">
+        <option value="count">Count - numeric or text</option>
+        <option value="count_disctinct">Count Distinct - numeric or text</option>
+        <option value="distinct">distinct (i.e., print a comma separated list) - numeric or text</option>
+        <option value="concat">concat (i.e., print a comma separated list) - numeric or text</option>
+    </xml>
+    <token name="@REFERENCES@">
+<![CDATA[
+------
+
+This tool is part of the `bedtools package`_ from the `Quinlan laboratory`_.
+
+.. _bedtools package: https://github.com/arq5x/bedtools2
+.. _Quinlan laboratory: http://cphg.virginia.edu/quinlan/
+
+
+**Citation**
+
+If you use this tool in Galaxy, please cite:
+
+Bjoern A. Gruening (2014), `Galaxy wrapper <https://github.com/bgruening/galaxytools>`_
+]]>
+    </token>
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1093/bioinformatics/btq033</citation>
+            <yield />
+        </citations>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/bedToBam1.bed	Thu May 12 06:20:51 2016 -0400
@@ -0,0 +1,5 @@
+chr1	100	200	foo
+chr1	180	250	bar
+chr1	250	500	world
+chr1	501	1000	peace
+
Binary file test-data/bedToBam_result.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mm9_chr1.len	Thu May 12 06:20:51 2016 -0400
@@ -0,0 +1,1 @@
+chr1	197195432
Binary file test-data/sortedBedToBam_result.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Thu May 12 06:20:51 2016 -0400
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="bedtools" version="2.24">
+        <repository changeset_revision="39b86c1e267d" name="package_bedtools_2_24" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="samtools" version="1.2">
+        <repository changeset_revision="f6ae3ba3f3c1" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>