| 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 bandwith |
|
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
|
4
|
|
|
4
|
|
609
|
use strict; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
101
|
|
|
111
|
4
|
|
|
4
|
|
11
|
use vars qw($MODVERSION %HOSTS %FORMATMAP $DEFAULTFORMAT); |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
211
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
$MODVERSION = '0.2'; |
|
114
|
4
|
|
|
4
|
|
735
|
use Bio::DB::RefSeq; |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
99
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
4
|
|
|
4
|
|
18
|
use base qw(Bio::DB::DBFetch); |
|
|
4
|
|
|
|
|
3
|
|
|
|
4
|
|
|
|
|
332
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
BEGIN { |
|
119
|
|
|
|
|
|
|
# you can add your own here theoretically. |
|
120
|
4
|
|
|
4
|
|
15
|
%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
|
4
|
|
|
|
|
9
|
%FORMATMAP = ( 'embl' => 'embl', |
|
129
|
|
|
|
|
|
|
'fasta' => 'fasta' |
|
130
|
|
|
|
|
|
|
); |
|
131
|
4
|
|
|
|
|
881
|
$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
|
1
|
|
|
1
|
1
|
2
|
my ($class, @args ) = @_; |
|
148
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new(@args); |
|
149
|
|
|
|
|
|
|
|
|
150
|
1
|
|
|
|
|
3
|
$self->{ '_hosts' } = {}; |
|
151
|
1
|
|
|
|
|
2
|
$self->{ '_formatmap' } = {}; |
|
152
|
|
|
|
|
|
|
|
|
153
|
1
|
|
|
|
|
6
|
$self->hosts(\%HOSTS); |
|
154
|
1
|
|
|
|
|
4
|
$self->formatmap(\%FORMATMAP); |
|
155
|
1
|
|
|
|
|
2
|
$self->{'_default_format'} = $DEFAULTFORMAT; |
|
156
|
|
|
|
|
|
|
|
|
157
|
1
|
|
|
|
|
4
|
return $self; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 Bio::DB::WebDBSeqI methods |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Overriding WebDBSeqI method to help newbies to retrieve sequences. |
|
164
|
|
|
|
|
|
|
EMBL database is all too often passed RefSeq accessions. This |
|
165
|
|
|
|
|
|
|
redirects those calls. See L. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 get_Stream_by_acc |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Title : get_Stream_by_acc |
|
171
|
|
|
|
|
|
|
Usage : $seq = $db->get_Seq_by_acc([$acc1, $acc2]); |
|
172
|
|
|
|
|
|
|
Function: Gets a series of Seq objects by accession numbers |
|
173
|
|
|
|
|
|
|
Returns : a Bio::SeqIO stream object |
|
174
|
|
|
|
|
|
|
Args : $ref : a reference to an array of accession numbers for |
|
175
|
|
|
|
|
|
|
the desired sequence entries |
|
176
|
|
|
|
|
|
|
Note : For GenBank, this just calls the same code for get_Stream_by_id() |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub get_Stream_by_acc { |
|
181
|
0
|
|
|
0
|
1
|
|
my ($self, $ids ) = @_; |
|
182
|
0
|
|
|
|
|
|
my $newdb = $self->_check_id($ids); |
|
183
|
0
|
0
|
0
|
|
|
|
if ($newdb && $newdb->isa('Bio::DB::RefSeq')) { |
|
184
|
0
|
|
|
|
|
|
return $newdb->get_seq_stream('-uids' => $ids, '-mode' => 'single'); |
|
185
|
|
|
|
|
|
|
} else { |
|
186
|
0
|
|
|
|
|
|
return $self->get_seq_stream('-uids' => $ids, '-mode' => 'single'); |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 _check_id |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Title : _check_id |
|
194
|
|
|
|
|
|
|
Usage : |
|
195
|
|
|
|
|
|
|
Function: |
|
196
|
|
|
|
|
|
|
Returns : A Bio::DB::RefSeq reference or throws |
|
197
|
|
|
|
|
|
|
Args : $id(s), $string |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub _check_id { |
|
202
|
0
|
|
|
0
|
|
|
my ($self, $ids) = @_; |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# NT contigs can not be retrieved |
|
205
|
0
|
0
|
|
|
|
|
$self->throw("NT_ contigs are whole chromosome files which are not part of regular". |
|
206
|
|
|
|
|
|
|
"database distributions. Go to ftp://ftp.ncbi.nih.gov/genomes/.") |
|
207
|
|
|
|
|
|
|
if $ids =~ /NT_/; |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
# Asking for a RefSeq from EMBL/GenBank |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
0
|
|
|
|
|
if ($ids =~ /N._/) { |
|
212
|
0
|
0
|
|
|
|
|
$self->warn("[$ids] is not a normal sequence entry but a RefSeq entry.". |
|
213
|
|
|
|
|
|
|
" Redirecting the request.\n") |
|
214
|
|
|
|
|
|
|
if $self->verbose >= 0; |
|
215
|
0
|
|
|
|
|
|
return Bio::DB::RefSeq->new(-verbose => $self->verbose); |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
1; |