From 2f96d33be7cc96a9eb3e539d1a21bf5f8b548c40 Mon Sep 17 00:00:00 2001 From: Wen-Yu Chung Date: Wed, 6 Feb 2008 18:07:00 +0000 Subject: [PATCH] fix a bug that caused list index out of range (because there's empty lines). --- .../datatypes/converters/fasta_to_tabular_converter.py | 8 ++++---- tools/fasta_tools/fasta_to_tabular.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py index 7cd6eeb137e..5a54570f060 100644 --- a/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py +++ b/lib/galaxy/datatypes/converters/fasta_to_tabular_converter.py @@ -4,7 +4,6 @@ Input: fasta, minimal length, maximal length Output: fasta Return sequences whose lengths are within the range. -Wen-Yu Chung """ import sys, os @@ -26,9 +25,10 @@ def __main__(): title = line sequence = '' else: - sequence += line - if line.split()[0].isdigit(): - sequence += ' ' + if line: + sequence += line + if line.split()[0].isdigit(): + sequence += ' ' if sequence: seq_hash[( sequence_count, title )] = sequence # return only those lengths are in the range diff --git a/tools/fasta_tools/fasta_to_tabular.py b/tools/fasta_tools/fasta_to_tabular.py index 7cd6eeb137e..5a54570f060 100644 --- a/tools/fasta_tools/fasta_to_tabular.py +++ b/tools/fasta_tools/fasta_to_tabular.py @@ -4,7 +4,6 @@ Input: fasta, minimal length, maximal length Output: fasta Return sequences whose lengths are within the range. -Wen-Yu Chung """ import sys, os @@ -26,9 +25,10 @@ def __main__(): title = line sequence = '' else: - sequence += line - if line.split()[0].isdigit(): - sequence += ' ' + if line: + sequence += line + if line.split()[0].isdigit(): + sequence += ' ' if sequence: seq_hash[( sequence_count, title )] = sequence # return only those lengths are in the range