diff --git a/datatype_converters_conf.xml.sample b/datatype_converters_conf.xml.sample
index dc2aff53547..d69672c7743 100644
--- a/datatype_converters_conf.xml.sample
+++ b/datatype_converters_conf.xml.sample
@@ -1,8 +1,9 @@
-
-
+
+
+
diff --git a/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py
new file mode 100644
index 00000000000..7cd6eeb137e
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py
@@ -0,0 +1,43 @@
+#! /usr/bin/python
+# This code exists in 2 places: ~/datatypes/converters and ~/tools/fasta_tools
+"""
+Input: fasta, minimal length, maximal length
+Output: fasta
+Return sequences whose lengths are within the range.
+Wen-Yu Chung
+"""
+
+import sys, os
+
+seq_hash = {}
+
+def __main__():
+ infile = sys.argv[1]
+ outfile = sys.argv[2]
+ title = ''
+ sequence = ''
+ sequence_count = 0
+ for i, line in enumerate( open( infile ) ):
+ line = line.rstrip( '\r\n' )
+ if line.startswith( '>' ):
+ if sequence:
+ sequence_count += 1
+ seq_hash[( sequence_count, title )] = sequence
+ title = line
+ sequence = ''
+ else:
+ sequence += line
+ if line.split()[0].isdigit():
+ sequence += ' '
+ if sequence:
+ seq_hash[( sequence_count, title )] = sequence
+ # return only those lengths are in the range
+ out = open( outfile, 'w' )
+ title_keys = seq_hash.keys()
+ title_keys.sort()
+ for i, fasta_title in title_keys:
+ sequence = seq_hash[( i, fasta_title )]
+ print >> out, "%s\t%s" %( fasta_title, sequence )
+ out.close()
+
+if __name__ == "__main__" : __main__()
\ No newline at end of file
diff --git a/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.xml b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.xml
new file mode 100644
index 00000000000..ca3519edc31
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.xml
@@ -0,0 +1,13 @@
+
+
+
+ fasta_to_tabular_converter.py $input $output
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tool_conf.xml.main b/tool_conf.xml.main
index 83bb9678d3a..7016b8f15a8 100644
--- a/tool_conf.xml.main
+++ b/tool_conf.xml.main
@@ -69,8 +69,11 @@
-->
diff --git a/tool_conf.xml.sample b/tool_conf.xml.sample
index 8a929b0354f..cd6365d6241 100644
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -55,14 +55,16 @@