4 # BioPerl module for Bio::DB::EMBL
6 # Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
8 # Copyright Jason Stajich
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::DB::EMBL - Database object interface for EMBL entry retrieval
22 $embl = Bio::DB::EMBL->new();
24 # remember that EMBL_ID does not equal GenBank_ID!
25 $seq = $embl->get_Seq_by_id('BUM'); # EMBL ID
26 print "cloneid is ", $seq->id, "\n";
28 # or changeing to accession number and Fasta format ...
29 $embl->request_format('fasta');
30 $seq = $embl->get_Seq_by_acc('J02231'); # EMBL ACC
31 print "cloneid is ", $seq->id, "\n";
33 # especially when using versions, you better be prepared
34 # in not getting what what want
36 $seq = $embl->get_Seq_by_version('J02231.1'); # EMBL VERSION
38 print "cloneid is ", $seq->id, "\n" unless $@;
40 # or ... best when downloading very large files, prevents
41 # keeping all of the file in memory
43 # also don't want features, just sequence so let's save bandwith
44 # and request Fasta sequence
45 $embl = Bio::DB::EMBL->new(-retrievaltype => 'tempfile' ,
47 my $seqio = $embl->get_Stream_by_id(['AC013798', 'AC021953'] );
48 while( my $clone = $seqio->next_seq ) {
49 print "cloneid is ", $clone->id, "\n";
54 Allows the dynamic retrieval of sequence objects L<Bio::Seq> from the
55 EMBL database using the dbfetch script at EBI:
56 L<http://www.ebi.ac.uk/cgi-bin/dbfetch>.
58 In order to make changes transparent we have host type (currently only
59 ebi) and location (defaults to ebi) separated out. This allows later
60 additions of more servers in different geographical locations.
62 The functionality of this module is inherited from L<Bio::DB::DBFetch>
63 which implements L<Bio::DB::WebDBSeqI>.
69 User feedback is an integral part of the evolution of this and other
70 Bioperl modules. Send your comments and suggestions preferably to one
71 of the Bioperl mailing lists. Your participation is much appreciated.
73 bioperl-l@bioperl.org - General discussion
74 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
78 Report bugs to the Bioperl bug tracking system to help us keep track
79 the bugs and their resolution. Bug reports can be submitted via the
82 http://bugzilla.open-bio.org/
84 =head1 AUTHOR - Heikki Lehvaslaiho
86 Email Heikki Lehvaslaiho E<lt>heikki-at-bioperl-dot-orgE<gt>
90 The rest of the documentation details each of the object
91 methods. Internal methods are usually preceded with a _
95 # Let the code begin...
97 package Bio
::DB
::EMBL
;
99 use vars
qw($MODVERSION %HOSTS %FORMATMAP $DEFAULTFORMAT);
104 use base qw(Bio::DB::DBFetch);
107 # you can add your own here theoretically.
110 baseurl
=> 'http://%s/cgi-bin/dbfetch?db=embl&style=raw',
112 'ebi' => 'www.ebi.ac.uk'
116 %FORMATMAP = ( 'embl' => 'embl',
119 $DEFAULTFORMAT = 'embl';
125 Usage : $gb = Bio::DB::GenBank->new(@options)
126 Function: Creates a new genbank handle
127 Returns : New genbank handle
128 Args : -delay number of seconds to delay between fetches (3s)
130 NOTE: There are other options that are used internally.
135 my ($class, @args ) = @_;
136 my $self = $class->SUPER::new
(@args);
138 $self->{ '_hosts' } = {};
139 $self->{ '_formatmap' } = {};
141 $self->hosts(\
%HOSTS);
142 $self->formatmap(\
%FORMATMAP);
143 $self->{'_default_format'} = $DEFAULTFORMAT;
149 =head2 Bio::DB::WebDBSeqI methods
151 Overriding WebDBSeqI method to help newbies to retrieve sequences.
152 EMBL database is all too often passed RefSeq accessions. This
153 redirects those calls. See L<Bio::DB::RefSeq>.
156 =head2 get_Stream_by_acc
158 Title : get_Stream_by_acc
159 Usage : $seq = $db->get_Seq_by_acc([$acc1, $acc2]);
160 Function: Gets a series of Seq objects by accession numbers
161 Returns : a Bio::SeqIO stream object
162 Args : $ref : a reference to an array of accession numbers for
163 the desired sequence entries
164 Note : For GenBank, this just calls the same code for get_Stream_by_id()
168 sub get_Stream_by_acc
{
169 my ($self, $ids ) = @_;
170 my $newdb = $self->_check_id($ids);
171 if ($newdb && $newdb->isa('Bio::DB::RefSeq')) {
172 return $newdb->get_seq_stream('-uids' => $ids, '-mode' => 'single');
174 return $self->get_seq_stream('-uids' => $ids, '-mode' => 'single');
184 Returns : A Bio::DB::RefSeq reference or throws
185 Args : $id(s), $string
190 my ($self, $ids) = @_;
192 # NT contigs can not be retrieved
193 $self->throw("NT_ contigs are whole chromosome files which are not part of regular".
194 "database distributions. Go to ftp://ftp.ncbi.nih.gov/genomes/.")
197 # Asking for a RefSeq from EMBL/GenBank
200 $self->warn("[$ids] is not a normal sequence entry but a RefSeq entry.".
201 " Redirecting the request.\n")
202 if $self->verbose >= 0;
203 return Bio
::DB
::RefSeq
->new(-verbose
=> $self->verbose);