[Bioperl-l] help needed with __DATA__

Heikki Lehvaslaiho heikki at nildram.co.uk
Sun Jul 13 12:03:08 EDT 2003


Could anyone suggest a fix, please:

In the new Bio::Restriction analysis system (the relevant classes are in
bioperl-live CVS head) the SeqIO approach is used to to load the default
set of enzymes into a EnzymeCollection from Bio::Restriction::IO::base
class. I've put the tab delimited list of default enzymes at the end of
the file after a '__DATA__' line and read it using 'while (<DATA>)'.

This seems to cause a problem. Consecutive calls to code does not seem
to reset the DATA file handle.

In the following code, the three blocks should work identically but only
the block executed first has enzymes in the collection.  One can
reshuffle the order of code blocks and only the first one will work.

---------------------------------------------
use Bio::Restriction::EnzymeCollection;
use Bio::Restriction::IO;
use strict;

# 1.
{
my $renzs = new Bio::Restriction::EnzymeCollection();
print scalar $renzs->each_enzyme, "\n";
}
#2.
{
my $renzs2 = new Bio::Restriction::EnzymeCollection();
print scalar $renzs2->each_enzyme, "\n";
}
#3.
{
my $in  = new Bio::Restriction::IO; # defaults to 'base.pm'
my $renzs3 = $in->read;
print scalar $renzs3->each_enzyme, "\n";
}
---------------------------

Adding 'close DATA' into base.pm will not help. The file handle is not
automatically opened.

Is this result reproducible?

I am using 'v5.8.0 built for i386-linux-thread-multi' 

I could use here documents instead, I guess,  but DATA should work, too.
	
	-Heikki






More information about the Bioperl-l mailing list