[Bioperl-l] Empty FASTA files with Bio::SeqIO
J.C. Diggans
jdiggans@genelogic.com
Wed, 20 Dec 2000 15:25:29 -0500
> It indeed came up some months ago, and it should be somewhere in the
> archives. The current design is intentional, but we decided to support
> empty sequences and reading and writing them in FASTA format (NOT in other
> formats). This will be part of the 0.7 release features. If you look at the
> task list, you'll find it.
I went ahead and patched my local version from 0.6.2 (patch below). It
was a quick fix, can anyone think of a case in which this would fail?
- jc
122,123c122,134
< my ($top,$sequence) = $entry =~ /^(.+?)\n([^>]+)/s
< or $self->throw("Can't parse entry");
---
> # Check for empty sequences and handle gracefully
> my ($top,$sequence);
> if( $entry =~ /^(.+?)\n([^>]+)/s ) {
> # There is valid sequence present
> ($top,$sequence) = $entry =~ /^(.+?)\n([^>]+)/s
> or $self->throw("Can't parse entry");
> } else {
> # There is no sequence present,
> $top = $entry =~ /^(.+?)\n/
> or $self->throw("Can't parse entry"); # save top
> $sequence = ""; # set sequence to empty string
> }
>
-------------------------------------------------
James Diggans Phone: 301.987.1756
Gene Logic, Inc. FAX: 301.987.1701
jdiggans@genelogic.com Cell: 301.908.2477
-------------------------------------------------