[Bioperl-l] [PATCH] Fix infinite loop in EMBL writer.

Adam Sjøgren adsj at novozymes.com
Wed Mar 10 08:46:02 EST 2010


This fix is an exact duplicate of the fix for bug #2915 - of
the Genbank writer, which was fixed in revision 16275.
---
 Bio/SeqIO/embl.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Bio/SeqIO/embl.pm b/Bio/SeqIO/embl.pm
index cfea1b6..de1bf11 100644
--- a/Bio/SeqIO/embl.pm
+++ b/Bio/SeqIO/embl.pm
@@ -1432,7 +1432,7 @@ sub _write_line_EMBL_regex {
 
   CHUNK: while($line) {
         foreach my $pat ($regex, '[,;\.\/-]\s|'.$regex, '[,;\.\/-]|'.$regex) {
-            if ($line =~ m/^(.{1,$subl})($pat)(.*)/ ) {
+            if ($line =~ m/^(.{0,$subl})($pat)(.*)/ ) {
                 my $l = $1.$2;
                 $l =~ s/#/ /g  # remove word wrap protection char '#'
                     if $pre1 eq "RA   ";
@@ -1441,6 +1441,7 @@ sub _write_line_EMBL_regex {
                 # be strict about not padding spaces according to
                 # genbank format
                 $l =~ s/\s+$//;
+                next CHUNK if ($l eq '');
                 push(@lines, $l);
                 next CHUNK;
             }
-- 
1.6.3.3


-- 
                                                          Adam Sjøgren
                                                    adsj at novozymes.com



More information about the Bioperl-l mailing list