Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bioperl/bioperl-live
Browse files Browse the repository at this point in the history
  • Loading branch information
fangly committed Mar 5, 2011
2 parents b774330 + 6a79bde commit 7407a26
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Bio/AlignIO/stockholm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ our %WRITEMAP = (
=head2 new
Title : new
Usage : my $alignio = Bio::AlignIO->new(-format => 'phylip'
Usage : my $alignio = Bio::AlignIO->new(-format => 'stockholm'
-file => '>file');
Function: Initialize a new L<Bio::AlignIO::phylip> reader or writer
Function: Initialize a new L<Bio::AlignIO::stockholm> reader or writer
Returns : L<Bio::AlignIO> object
Args : -line_length : length of the line for the alignment block
-alphabet : symbol alphabet to set the sequences to. If not set,
Expand Down
7 changes: 4 additions & 3 deletions Bio/Restriction/Analysis.pm
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ sub fragment_maps {
# for every enzyme this should cut down on the amount of
# duplicated data we are trying to save in memory and make this
# faster and easier for large sequences, e.g. genome analysis

my @cut_positions;
if (ref $enz eq '') {
if (ref $enz eq '' && exists $self->{'_cut_positions'}->{$enz}) {
@cut_positions=@{$self->{'_cut_positions'}->{$enz}};
} elsif ($enz->isa("Bio::Restriction::EnzymeI")) {
@cut_positions=@{$self->{'_cut_positions'}->{$enz->name}};
Expand All @@ -531,7 +531,7 @@ sub fragment_maps {
@cut_positions=@{$self->{'_cut_positions'}->{'multiple_digest'}};
}

unless ($cut_positions[0]) {
unless (defined($cut_positions[0])) {
# it doesn't cut
# return the whole sequence
# this should probably have the is_circular command
Expand All @@ -553,6 +553,7 @@ sub fragment_maps {

my $start=1; my $stop; my %seq; my %stop;
foreach $stop (@cuts) {
next if !$stop; # cuts at beginning of sequence
$seq{$start}=$self->{'_seq'}->subseq($start, $stop);
$stop{$start}=$stop;
$start=$stop+1;
Expand Down
21 changes: 20 additions & 1 deletion t/Restriction/Analysis.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BEGIN {
use lib '.';
use Bio::Root::Test;

test_begin(-tests => 177);
test_begin(-tests => 180);

use_ok('Bio::Restriction::Enzyme');
use_ok('Bio::Restriction::Enzyme::MultiCut');
Expand Down Expand Up @@ -292,3 +292,22 @@ eval {$re = Bio::Restriction::Enzyme->new(

ok $@;
like($@, qr(Unrecognized characters in site), 'bug 2139');

# 0-pos bug (Elia Stupka)

$seq = Bio::Seq->new(
-display_name => 'foo',
-alphabet => 'dna',
-seq => 'GATCNNNNGATC'
);

$ra = Bio::Restriction::Analysis->new(-seq=>$seq);

is $ra->fragments('HindIII'), 1, 'number of HindIII fragments';
is $ra->fragments('BfuCI'), 2, 'number of EcoRI fragments';

# passing a bad enzyme name

is $ra->fragments('FooBarI'), 1, 'number of RsaI fragments';


0 comments on commit 7407a26

Please sign in to comment.