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::RefSeq - Database object interface for RefSeq retrieval |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Bio::DB::RefSeq; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$db = Bio::DB::RefSeq->new(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# most of the time RefSeq_ID eq RefSeq acc |
26
|
|
|
|
|
|
|
$seq = $db->get_Seq_by_id('NM_006732'); # RefSeq ID |
27
|
|
|
|
|
|
|
print "accession is ", $seq->accession_number, "\n"; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# or changeing to accession number and Fasta format ... |
30
|
|
|
|
|
|
|
$db->request_format('fasta'); |
31
|
|
|
|
|
|
|
$seq = $db->get_Seq_by_acc('NM_006732'); # RefSeq ACC |
32
|
|
|
|
|
|
|
print "seq is ", $seq->seq, "\n"; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# especially when using versions, you better be prepared |
35
|
|
|
|
|
|
|
# in not getting what what want |
36
|
|
|
|
|
|
|
eval { |
37
|
|
|
|
|
|
|
$seq = $db->get_Seq_by_version('NM_006732.1'); # RefSeq VERSION |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
print "accesion is ", $seq->accession_number, "\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
|
|
|
|
|
|
|
$db = Bio::DB::RefSeq->new(-retrievaltype => 'tempfile' , |
47
|
|
|
|
|
|
|
-format => 'fasta'); |
48
|
|
|
|
|
|
|
my $seqio = $db->get_Stream_by_id(['NM_006732', 'NM_005252'] ); |
49
|
|
|
|
|
|
|
while( my $seq = $seqio->next_seq ) { |
50
|
|
|
|
|
|
|
print "seqid is ", $seq->id, "\n"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Allows the dynamic retrieval of sequence objects L from the |
56
|
|
|
|
|
|
|
RefSeq database using the dbfetch script at EBI: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
http://www.ebi.ac.uk/Tools/dbfetch/dbfetch |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
In order to make changes transparent we have host type (currently only |
61
|
|
|
|
|
|
|
ebi) and location (defaults to ebi) separated out. This allows later |
62
|
|
|
|
|
|
|
additions of more servers in different geographical locations. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The functionality of this module is inherited from L |
65
|
|
|
|
|
|
|
which implements L. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This module retrieves entries from EBI although it |
68
|
|
|
|
|
|
|
retrives database entries produced at NCBI. When read into bioperl |
69
|
|
|
|
|
|
|
objects, the parser for GenBank format it used. RefSeq is a |
70
|
|
|
|
|
|
|
NONSTANDARD GenBank file so be ready for surprises. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 FEEDBACK |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 Mailing Lists |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
77
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to one |
78
|
|
|
|
|
|
|
of the Bioperl mailing lists. Your participation is much appreciated. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
81
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Support |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
I |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
90
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
91
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
92
|
|
|
|
|
|
|
with code and data examples if at all possible. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 Reporting Bugs |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
97
|
|
|
|
|
|
|
the bugs and their resolution. Bug reports can be submitted via the |
98
|
|
|
|
|
|
|
web: |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR - Heikki Lehvaslaiho |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Email Heikki Lehvaslaiho Eheikki-at-bioperl-dot-orgE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 APPENDIX |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The rest of the documentation details each of the object |
109
|
|
|
|
|
|
|
methods. Internal methods are usually preceded with a _ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Let the code begin... |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
package Bio::DB::RefSeq; |
116
|
5
|
|
|
5
|
|
449
|
use strict; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
125
|
|
117
|
5
|
|
|
5
|
|
14
|
use vars qw($MODVERSION %HOSTS %FORMATMAP $DEFAULTFORMAT); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
314
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$MODVERSION = '0.1'; |
120
|
|
|
|
|
|
|
|
121
|
5
|
|
|
5
|
|
16
|
use base qw(Bio::DB::DBFetch); |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
1406
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
BEGIN { |
124
|
|
|
|
|
|
|
# you can add your own here theoretically. |
125
|
5
|
|
|
5
|
|
21
|
%HOSTS = ( |
126
|
|
|
|
|
|
|
'dbfetch' => { |
127
|
|
|
|
|
|
|
baseurl => 'http://%s/Tools/dbfetch/dbfetch?db=refseq&style=raw', |
128
|
|
|
|
|
|
|
hosts => { |
129
|
|
|
|
|
|
|
'ebi' => 'www.ebi.ac.uk' |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
); |
133
|
5
|
|
|
|
|
15
|
%FORMATMAP = ( 'embl' => 'embl', |
134
|
|
|
|
|
|
|
'genbank' => 'genbank', |
135
|
|
|
|
|
|
|
'fasta' => 'fasta' |
136
|
|
|
|
|
|
|
); |
137
|
5
|
|
|
|
|
843
|
$DEFAULTFORMAT = 'genbank'; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub new { |
141
|
0
|
|
|
0
|
1
|
|
my ($class, @args ) = @_; |
142
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@args); |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
$self->{ '_hosts' } = {}; |
145
|
0
|
|
|
|
|
|
$self->{ '_formatmap' } = {}; |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
$self->hosts(\%HOSTS); |
148
|
0
|
|
|
|
|
|
$self->formatmap(\%FORMATMAP); |
149
|
0
|
|
|
|
|
|
$self->{'_default_format'} = $DEFAULTFORMAT; |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
return $self; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub get_seq_stream { |
156
|
0
|
|
|
0
|
1
|
|
my ($self,%qualifiers) = @_; |
157
|
0
|
0
|
|
|
|
|
if( exists $qualifiers{'-uids'} ) { |
158
|
0
|
0
|
|
|
|
|
if( ref($qualifiers{'-uids'}) =~ /ARRAY/i ) { |
159
|
0
|
|
|
|
|
|
foreach my $u ( @{$qualifiers{'-uids'}} ) { |
|
0
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
$u =~ s/^(\S+)\|//; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} else { |
163
|
0
|
|
|
|
|
|
$qualifiers{'-uids'} =~ s/^(\S+)\|//; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
} |
166
|
0
|
|
|
|
|
|
$self->SUPER::get_seq_stream(%qualifiers); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
1; |