diff --git a/datatypes_conf.xml.sample b/datatypes_conf.xml.sample
index cb49a79ce73..f224244d6a0 100644
--- a/datatypes_conf.xml.sample
+++ b/datatypes_conf.xml.sample
@@ -58,6 +58,7 @@
+
diff --git a/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py
new file mode 100644
index 00000000000..5943be5cce5
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#code is same as ~/tools/stats/wiggle_to_simple.py
+
+"""
+Read a wiggle track and print out a series of lines containing
+"chrom position score". Ignores track lines, handles bed, variableStep
+and fixedStep wiggle lines.
+"""
+import sys
+from galaxy import eggs
+import pkg_resources; pkg_resources.require( "bx-python" )
+import bx.wiggle
+from galaxy.tools.exception_handling import *
+
+def stop_err( msg ):
+ sys.stderr.write( msg )
+ sys.exit()
+
+def main():
+ if len( sys.argv ) > 1:
+ in_file = open( sys.argv[1] )
+ else:
+ in_file = open( sys.stdin )
+
+ if len( sys.argv ) > 2:
+ out_file = open( sys.argv[2], "w" )
+ else:
+ out_file = sys.stdout
+
+ try:
+ for fields in bx.wiggle.IntervalReader( UCSCOutWrapper( in_file ) ):
+ out_file.write( "%s\n" % "\t".join( map( str, fields ) ) )
+ except UCSCLimitException:
+ # Wiggle data was truncated, at the very least need to warn the user.
+ print 'Encountered message from UCSC: "Reached output limit of 100000 data values", so be aware your data was truncated.'
+ except ValueError, e:
+ in_file.close()
+ out_file.close()
+ stop_err( str( e ) )
+
+ in_file.close()
+ out_file.close()
+
+if __name__ == "__main__": main()
diff --git a/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.xml b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.xml
new file mode 100644
index 00000000000..ff9a7cfe82d
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.xml
@@ -0,0 +1,11 @@
+
+
+
+ wiggle_to_simple_converter.py $input $out_file1
+
+
+
+
+
+
+
diff --git a/tool_conf.xml.main b/tool_conf.xml.main
index 18025ec3926..ee76623594d 100644
--- a/tool_conf.xml.main
+++ b/tool_conf.xml.main
@@ -47,6 +47,7 @@
+
diff --git a/tool_conf.xml.sample b/tool_conf.xml.sample
index 8cea9144046..7c62f97a9be 100644
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -71,6 +71,7 @@
+
diff --git a/tools/filters/wiggle_to_simple.py b/tools/filters/wiggle_to_simple.py
new file mode 100755
index 00000000000..ecae7ec1804
--- /dev/null
+++ b/tools/filters/wiggle_to_simple.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+"""
+Read a wiggle track and print out a series of lines containing
+"chrom position score". Ignores track lines, handles bed, variableStep
+and fixedStep wiggle lines.
+"""
+import sys
+from galaxy import eggs
+import pkg_resources; pkg_resources.require( "bx-python" )
+import bx.wiggle
+from galaxy.tools.exception_handling import *
+
+def stop_err( msg ):
+ sys.stderr.write( msg )
+ sys.exit()
+
+def main():
+ if len( sys.argv ) > 1:
+ in_file = open( sys.argv[1] )
+ else:
+ in_file = open( sys.stdin )
+
+ if len( sys.argv ) > 2:
+ out_file = open( sys.argv[2], "w" )
+ else:
+ out_file = sys.stdout
+
+ try:
+ for fields in bx.wiggle.IntervalReader( UCSCOutWrapper( in_file ) ):
+ out_file.write( "%s\n" % "\t".join( map( str, fields ) ) )
+ except UCSCLimitException:
+ # Wiggle data was truncated, at the very least need to warn the user.
+ print 'Encountered message from UCSC: "Reached output limit of 100000 data values", so be aware your data was truncated.'
+ except ValueError, e:
+ in_file.close()
+ out_file.close()
+ stop_err( str( e ) )
+
+ in_file.close()
+ out_file.close()
+
+if __name__ == "__main__": main()
diff --git a/tools/filters/wiggle_to_simple.xml b/tools/filters/wiggle_to_simple.xml
new file mode 100644
index 00000000000..98b5bf30fcd
--- /dev/null
+++ b/tools/filters/wiggle_to_simple.xml
@@ -0,0 +1,88 @@
+
+ converter
+ wiggle_to_simple.py $input $out_file1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**Syntax**
+
+This tool converts wiggle data into interval type.
+
+- **Wiggle format**: The .wig format is line-oriented. Wiggle data is preceded by a UCSC track definition line. Following the track definition line is the track data, which can be entered in three different formats described below.
+
+ - **BED format** with no declaration line and four columns of data::
+
+ chromA chromStartA chromEndA dataValueA
+ chromB chromStartB chromEndB dataValueB
+
+ - **variableStep** two column data; started by a declaration line and followed with chromosome positions and data values::
+
+ variableStep chrom=chrN [span=windowSize]
+ chromStartA dataValueA
+ chromStartB dataValueB
+
+ - **fixedStep** single column data; started by a declaration line and followed with data values::
+
+ fixedStep chrom=chrN start=position step=stepInterval [span=windowSize]
+ dataValue1
+ dataValue2
+
+-----
+
+**Example**
+
+- input wiggle format file::
+
+ #track type=wiggle_0 name="Bed Format" description="BED format"
+ chr19 59302000 59302300 -1.0
+ chr19 59302300 59302600 -0.75
+ chr19 59302600 59302900 -0.50
+ chr19 59302900 59303200 -0.25
+ chr19 59303200 59303500 0.0
+ #track type=wiggle_0 name="variableStep" description="variableStep format"
+ variableStep chrom=chr19 span=150
+ 59304701 10.0
+ 59304901 12.5
+ 59305401 15.0
+ 59305601 17.5
+ #track type=wiggle_0 name="fixedStep" description="fixed step" visibility=full
+ fixedStep chrom=chr19 start=59307401 step=300 span=200
+ 1000
+ 900
+ 800
+ 700
+ 600
+
+- convert the above file to interval file::
+
+ chr19 59302000 59302300 + -1.0
+ chr19 59302300 59302600 + -0.75
+ chr19 59302600 59302900 + -0.5
+ chr19 59302900 59303200 + -0.25
+ chr19 59303200 59303500 + 0.0
+ chr19 59304701 59304851 + 10.0
+ chr19 59304901 59305051 + 12.5
+ chr19 59305401 59305551 + 15.0
+ chr19 59305601 59305751 + 17.5
+ chr19 59307701 59307901 + 1000.0
+ chr19 59308001 59308201 + 900.0
+ chr19 59308301 59308501 + 800.0
+ chr19 59308601 59308801 + 700.0
+ chr19 59308901 59309101 + 600.0
+
+
+