File Coverage

blib/lib/Bio/DB/EMBL.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 26 26 100.0


line stmt bran cond sub pod time code
1             #
2             #
3             # BioPerl module for Bio::DB::EMBL
4             #
5             # Please direct questions and support issues to
6             #
7             # Cared for by Heikki Lehvaslaiho
8             #
9             # Copyright Jason Stajich
10             #
11             # You may distribute this module under the same terms as perl itself
12              
13             # POD documentation - main docs before the code
14              
15             =head1 NAME
16              
17             Bio::DB::EMBL - Database object interface for EMBL entry retrieval
18              
19             =head1 SYNOPSIS
20              
21             use Bio::DB::EMBL;
22              
23             $embl = Bio::DB::EMBL->new();
24              
25             # remember that EMBL_ID does not equal GenBank_ID!
26             $seq = $embl->get_Seq_by_id('HSFOS'); # EMBL ID
27             print "cloneid is ", $seq->id, "\n";
28              
29             # or changeing to accession number and Fasta format ...
30             $embl->request_format('fasta');
31             $seq = $embl->get_Seq_by_acc('J02231'); # EMBL ACC
32             print "cloneid is ", $seq->id, "\n";
33              
34             # especially when using versions, you better be prepared
35             # in not getting what what want
36             eval {
37             $seq = $embl->get_Seq_by_version('J02231.1'); # EMBL VERSION
38             };
39             print "cloneid is ", $seq->id, "\n" unless $@;
40              
41             # or ... best when downloading very large files, prevents
42             # keeping all of the file in memory
43              
44             # also don't want features, just sequence so let's save bandwidth
45             # and request Fasta sequence
46             $embl = Bio::DB::EMBL->new(-retrievaltype => 'tempfile' ,
47             -format => 'fasta');
48             my $seqio = $embl->get_Stream_by_id(['AC013798', 'AC021953'] );
49             while( my $clone = $seqio->next_seq ) {
50             print "cloneid is ", $clone->id, "\n";
51             }
52              
53             =head1 DESCRIPTION
54              
55             Allows the dynamic retrieval of sequence objects L from the
56             EMBL database using the dbfetch script at EBI:
57             L.
58              
59             In order to make changes transparent we have host type (currently only
60             ebi) and location (defaults to ebi) separated out. This allows later
61             additions of more servers in different geographical locations.
62              
63             The functionality of this module is inherited from L
64             which implements L.
65              
66             =head1 FEEDBACK
67              
68             =head2 Mailing Lists
69              
70             User feedback is an integral part of the evolution of this and other
71             Bioperl modules. Send your comments and suggestions preferably to one
72             of the Bioperl mailing lists. Your participation is much appreciated.
73              
74             bioperl-l@bioperl.org - General discussion
75             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
76              
77             =head2 Support
78              
79             Please direct usage questions or support issues to the mailing list:
80              
81             I
82              
83             rather than to the module maintainer directly. Many experienced and
84             reponsive experts will be able look at the problem and quickly
85             address it. Please include a thorough description of the problem
86             with code and data examples if at all possible.
87              
88             =head2 Reporting Bugs
89              
90             Report bugs to the Bioperl bug tracking system to help us keep track
91             the bugs and their resolution. Bug reports can be submitted via the
92             web:
93              
94             https://github.com/bioperl/bioperl-live/issues
95              
96             =head1 AUTHOR - Heikki Lehvaslaiho
97              
98             Email Heikki Lehvaslaiho Eheikki-at-bioperl-dot-orgE
99              
100             =head1 APPENDIX
101              
102             The rest of the documentation details each of the object
103             methods. Internal methods are usually preceded with a _
104              
105             =cut
106              
107             # Let the code begin...
108              
109             package Bio::DB::EMBL;
110             $Bio::DB::EMBL::VERSION = '1.7.3';
111 1     1   211309 use strict;
  1         6  
  1         35  
112 1     1   5 use vars qw($MODVERSION %HOSTS %FORMATMAP $DEFAULTFORMAT);
  1         3  
  1         79  
113              
114             $MODVERSION = '0.2';
115              
116 1     1   6 use base qw(Bio::DB::DBFetch);
  1         2  
  1         530  
117              
118             BEGIN {
119             # you can add your own here theoretically.
120 1     1   66722 %HOSTS = (
121             'dbfetch' => {
122             baseurl => 'http://%s/Tools/dbfetch/dbfetch?db=embl&style=raw',
123             hosts => {
124             'ebi' => 'www.ebi.ac.uk'
125             }
126             }
127             );
128 1         4 %FORMATMAP = ( 'embl' => 'embl',
129             'fasta' => 'fasta'
130             );
131 1         106 $DEFAULTFORMAT = 'embl';
132             }
133              
134             =head2 new
135              
136             Title : new
137             Usage : $gb = Bio::DB::GenBank->new(@options)
138             Function: Creates a new genbank handle
139             Returns : New genbank handle
140             Args : -delay number of seconds to delay between fetches (3s)
141              
142             NOTE: There are other options that are used internally.
143              
144             =cut
145              
146             sub new {
147 3     3 1 1067573 my ($class, @args ) = @_;
148 3         48 my $self = $class->SUPER::new(@args);
149              
150 3         20331 $self->{ '_hosts' } = {};
151 3         18 $self->{ '_formatmap' } = {};
152              
153 3         36 $self->hosts(\%HOSTS);
154 3         54 $self->formatmap(\%FORMATMAP);
155 3         39 $self->{'_default_format'} = $DEFAULTFORMAT;
156              
157 3         34 return $self;
158             }
159              
160             1;