~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to Bio/DB/BioFetch.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: BioFetch.pm,v 1.29.4.1 2006/10/02 23:10:14 sendu Exp $
 
1
# $Id: BioFetch.pm 15423 2009-01-21 17:35:21Z cjfields $
2
2
#
3
3
# BioPerl module for Bio::DB::BioFetch
4
4
#
23
23
 
24
24
 use Bio::DB::BioFetch;
25
25
 
26
 
 $bf = new Bio::DB::BioFetch;
 
26
 $bf = Bio::DB::BioFetch->new();
27
27
 
28
28
 $seq = $bf->get_Seq_by_id('BUM');  # EMBL or SWALL ID
29
29
 
30
30
 # change formats, storage procedures
31
 
 $bf = new Bio::DB::BioFetch(-format        => 'fasta',
 
31
 $bf = Bio::DB::BioFetch->new(-format        => 'fasta',
32
32
                             -retrievaltype => 'tempfile',
33
33
                             -db            => 'EMBL');
34
34
 
139
139
            genbank   => 'genbank',
140
140
            namespace => 'genpep',
141
141
        },
 
142
        'unisave' => {
 
143
            default   => 'swiss',
 
144
            swissprot => 'swiss',
 
145
            fasta     => 'fasta',
 
146
            namespace => 'unisave',
 
147
        }
142
148
    );
143
149
}
144
150
 
374
380
  if (@_) {
375
381
 
376
382
      my $db = lc shift;
377
 
      $FORMATMAP{$db} or $self->throw("invalid db [$db], must be one of [".
 
383
      my $base = $self->url_base_address;
 
384
      $FORMATMAP{$db} or $self->throw("invalid db [$db] at [$base], must be one of [".
378
385
                                     join(' ',keys %FORMATMAP).  "]");
379
386
      $self->{_db} = $db;
380
387
  }
415
422
    open (F,$args{'location'}) or $self->throw("Couldn't open $args{location}: $!");
416
423
    # this is dumb, but the error may be anywhere on the first three lines because the
417
424
    # CGI headers are sometimes printed out by the server...
418
 
    my @data = (scalar <F>,scalar <F>,scalar <F>);
 
425
    my @data = grep {defined $_} (scalar <F>,scalar <F>,scalar <F>);
419
426
    if (join('',@data) =~ /^ERROR (\d+) (.+)/m) {
420
427
      $self->throw("BioFetch Error $1: $2");
421
428
    }
501
508
    my ($self, $id) = @_;
502
509
 
503
510
    # NT contigs can not be retrieved
504
 
    $self->throw("NT_ contigs are whole chromosome files which are not part of regular".
 
511
    $self->throw("NT_ contigs are whole chromosome files which are not part of regular ".
505
512
                 "database distributions. Go to ftp://ftp.ncbi.nih.gov/genomes/.") 
506
513
        if $id =~ /NT_/;
507
514