[Bioperl-l] "feature" in Bio::Restriction::Analysis

Andrew Nunberg anunberg at oriongenomics.com
Wed Dec 22 15:45:37 EST 2004

Sorry if this has been posted before.
I am using Bioperl 1.4 from cvs

If Bio::Restriction::Analysis->cutters returns the entire enzyme collection
if does not find any enzymes that cut.

I tried the following code:

my $seq = Bio::PrimarySeq->new(-seq=>'ggacgaggttttcctcctgtt');
my $ra = Bio::Restriction::Analysis->new(-seq=>$seq);
print "max cutter is ",$ra->max_cuts,"\n";
my $cutters = $ra->cutters;

for my $enz ($cutters->each_enzyme){
    print join("\t",($enz->name,$enz->string,$ra->seq->seq)),"\n";

The result was that every enzyme was printed out in the default collection
used in the analysis, even those that
Could not possibly be in the sequence.

Looking at the code I discovered the problem

>From the cutters subroutine in Bio::Restriction::Analysis-

By default, no args passed to cutters, then  $start=1

However this line of code appears after this assignment
$start = $self->{'maximum_cuts'} if $start > $self->{'maximum_cuts'};

If there are 0 maximum_cuts then $start is then set to 0, meaning that the
cutters subroutine will look for enzymes that cut 0 or more times.

I inserted this line right after the collection object is made but before
The searchis done for enzymes that cut.  This apparently fixes the problem

 my $set = new Bio::Restriction::EnzymeCollection(-empty => 1);
-->    #return an empty set if nothing cut
-->    return $set unless $self->{'maximum_cuts'};

Andrew Nunberg
Orion Genomics

More information about the Bioperl-l mailing list