~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to Bio/Restriction/EnzymeCollection.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: EnzymeCollection.pm,v 1.10.4.2 2006/11/08 17:25:54 sendu Exp $
 
1
# $Id: EnzymeCollection.pm 14571 2008-02-29 01:31:59Z cjfields $
2
2
#-------------------------------------------------------------------------------
3
3
#
4
4
# BioPerl module Bio::Restriction::EnzymeCollection
148
148
 
149
149
use Data::Dumper;
150
150
 
151
 
use vars qw ();
152
151
use base qw(Bio::Root::Root);
153
152
 
154
 
 
155
153
=head2 new
156
154
 
157
155
 Title     : new
313
311
 
314
312
sub blunt_enzymes {
315
313
    my $self=shift;
316
 
    my $bs = new Bio::Restriction::EnzymeCollection(-empty => 1);
 
314
    my $bs = Bio::Restriction::EnzymeCollection->new(-empty => 1);
317
315
    return $bs->enzymes(  grep { $_->overhang eq 'blunt' }  $self->each_enzyme );
318
316
}
319
317
 
343
341
 
344
342
    if (scalar @_ == 1 ) {
345
343
        my $size = shift;
346
 
        $self->throw("Need a positive number [$size]")
347
 
            unless $size =~ /[+]?[\d\.]+/;
348
 
 
349
 
        my $bs = new Bio::Restriction::EnzymeCollection(-empty => 1);
350
 
 
351
 
        foreach my $e ($self->each_enzyme) {
352
 
            ##print $e->name, ": ", $e->cutter, "\n"  if $e->cutter == $size;
353
 
            $bs->enzymes($e) if $e->cutter == $size;
 
344
        my @sizes;
 
345
        (ref $size eq 'ARRAY') ? push @sizes, @{$size} : push @sizes, $size;
 
346
        my $bs = Bio::Restriction::EnzymeCollection->new(-empty => 1);
 
347
        for my $size (@sizes) {
 
348
            $self->throw("Need a positive number [$size]")
 
349
                unless $size =~ /[+]?[\d\.]+/;
 
350
            foreach my $e ($self->each_enzyme) {
 
351
                ##print $e->name, ": ", $e->cutter, "\n"  if $e->cutter == $size;
 
352
                $bs->enzymes($e) if $e->cutter == $size;
 
353
            }
354
354
        }
355
355
        return $bs;
356
 
        #return $bs->enzymes(  grep { ($_->cutter == $size) }  $self->each_enzyme );
357
356
 
358
357
    } else { # named arguments
359
358
 
374
373
        $inclusive = 1 if $inclusive or not $exclusive;
375
374
        $inclusive = 0 if $exclusive;
376
375
 
377
 
        my $bs = new Bio::Restriction::EnzymeCollection(-empty => 1);
 
376
        my $bs = Bio::Restriction::EnzymeCollection->new(-empty => 1);
378
377
        if ($inclusive) {
379
378
            foreach my $e ($self->each_enzyme) {
380
379
                $bs->enzymes($e) if $e->cutter >= $start and $e->cutter <= $end;