[Bioperl-l] Bio::Restriction::IO query

Fairley, Derek Derek.Fairley at bll.n-i.nhs.uk
Tue May 23 10:39:16 EDT 2006

Hi folks,

I'm new to BioPerl, and struggling to make the Bio::Restriction::*
modules work (using BioPerl-1.4; Perl-5.8.1; Linux-2.4). Specifically,
I'm having some trouble understanding the behaviour of the
Bio::Restriction::IO module. I'm trying to use this to create a
Bio::Restriction::EnzymeCollection object from a local REBASE file
(which is in bairoch-format); this will in turn be passed to a
Bio::Restriction::Analysis object.

The following test script (derived from the Bio::Restriction::IO
perldoc) runs fine:

#! /usr/bin/perl -w
use strict;
use warnings;
use Bio::Restriction::IO;

my $in = Bio::Restriction::IO->new(	-file => "REBASE_file",
						-format =>'Bairoch');
my $collection = $in->read();
print "Number of REs in the collection: ", scalar
$collection->each_enzyme, "\n";

#note that using -format=>'bairoch' without capitalisation (as shown in
perldoc synopsis) throws an exception: Failed to load module

However... the test script returns the number 532 - the number of
enzymes in the default enzyme set - regardless of the number of enzymes
in the file. A default Bio::Restriction::EnzymeCollection object has
presumably been created (as the 'read()' and 'each_enzyme' methods are
available) but it didn't come from the local file. The result is the
same if the Bio::Restriction::IO->new() method is called with no
arguments - a default EnzymeCollection object is created. It's not clear
to me where this has come from.

My (mis?)understanding was that the default set of enzymes would be
loaded on creation of a new Bio::Restriction::Analysis object (in the
absence of a -enzymes=>... argument). Presumably this is down to my poor
understanding of the BioPerl object model... ;-)

So: how should I create an EnzymeCollection object from file?

Any help or advice would be gratefully received.

PS. Congratulations to the development team for creating a very
impressive and useful open source toolkit.


Derek Fairley, Ph.D.
Regional Virus Laboratory,
Kelvin Building,
Royal Victoria Hospital, 
Grosvenor Road,
N. Ireland.
BT12 6BA

Tel. +44 (0)2890 635303

More information about the Bioperl-l mailing list