[Bioperl-l] recursion limit reached for a gbk file

Gopal gopal.cshl at gmail.com
Thu Jun 10 12:24:31 EDT 2010


I get a  error message "Complex regular subexpression recursion limit
(32766) exceeded " when I try to parse CDS from a microbial genbank file.
Apparently  recursion limit is universal and that means,
others have somehow overcome this problem.

The subroutine that triggers this error is pasted below:

(based on "Beginning perl for Bioinformatics"  as I am trying to adapt an
example in that book for my work)

$fh = open_file($library);

$offset = tell($fh);

while( $record = get_next_record($fh) ) {

my $locus=( );

($annotation, $dna) = get_annotation_and_dna($record);

$offset = tell($fh);

  # Extract the fields of the annotation
%fields = parse_annotation($annotation);

Sub-routine that triggers the error message:

sub parse_annotation {

    my($annotation) = @_;
    my(%results) = (  );

    while( $annotation =~ /^[A-Z].*\n(^\s.*\n)*/gm ) {
        my $value = $&;
        (my $key = $value) =~ s/^([A-Z]+).*/$1/s;
        $results{$key} = $value;

    return %results;



More information about the Bioperl-l mailing list