GenPept.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 4 / 4 totaltotal 94.8% 37 / 39 CC 2 SCAR 2.3
CC
2
Cov
93%
get_params
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« GenBank.pm ↑ Summary EntrezGene.pm »
1 #
2 # BioPerl module for Bio::DB::GenPept
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Aaron Mackey <amackey@virginia.edu>
7 #
8 # Copyright Aaron Mackey
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 # completely reworked by Jason Stajich to use Bio::DB::WebDBSeqI 2000-12-12
15  
16 =head1 NAME
17  
18 Bio::DB::GenPept - Database object interface to GenPept
19  
20 =head1 SYNOPSIS
21  
22 $gb = Bio::DB::GenPept->new();
23  
24 $seq = $gb->get_Seq_by_id('195055'); # Unique ID
25  
26 # or ...
27  
28 $seq = $gb->get_Seq_by_acc('P09651.5'); # Accession Number
29  
30 my $seqio = $gb->get_Stream_by_id(['195055', 'P09651.5']);
31 while( my $seq = $seqio->next_seq ) {
32 print "seq is is ", $seq->display_id, "\n";
33 }
34  
35 =head1 DESCRIPTION
36  
37 Allows the dynamic retrieval of Sequence objects (Bio::Seq) from the GenPept
38 database at NCBI, via an Entrez query.
39  
40 WARNING: Please do NOT spam the Entrez web server with multiple requests.
41 NCBI offers Batch Entrez for this purpose. Batch Entrez support will likely
42 be supported in a future version of DB::GenPept.
43  
44 Currently the only return format supported by NCBI Entrez for GenPept
45 database is GenPept format, so any format specification passed to
46 GenPept will be ignored still be forced to GenPept format (which is
47 just GenBank format).
48  
49 =head1 FEEDBACK
50  
51 =head2 Mailing Lists
52  
53 User feedback is an integral part of the
54 evolution of this and other Bioperl modules. Send
55 your comments and suggestions preferably to one
56 of the Bioperl mailing lists. Your participation
57 is much appreciated.
58  
59 bioperl-l@bioperl.org - General discussion
60 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
61  
62 =head2 Support
63  
64 Please direct usage questions or support issues to the mailing list:
65  
66 I<bioperl-l@bioperl.org>
67  
68 rather than to the module maintainer directly. Many experienced and
69 reponsive experts will be able look at the problem and quickly
70 address it. Please include a thorough description of the problem
71 with code and data examples if at all possible.
72  
73 =head2 Reporting Bugs
74  
75 Report bugs to the Bioperl bug tracking system to help us keep track
76 the bugs and their resolution. Bug reports can be submitted via the
77 web:
78  
79 https://github.com/bioperl/bioperl-live/issues
80  
81 =head1 AUTHOR - Aaron Mackey, Jason Stajich
82  
83 Email amackey@virginia.edu
84 Email jason@bioperl.org
85  
86 =head1 APPENDIX
87  
88 The rest of the documentation details each of the object
89 methods. Internal methods are usually preceded with a _
90  
91 =cut
92  
93 # Let the code begin...
94  
95 package Bio::DB::GenPept;
96 2 $Bio::DB::GenPept::VERSION = '1.7.8';
97 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
98 2 ▶use vars qw($DEFAULTFORMAT $DEFAULTMODE %PARAMSTRING);
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 2 ▶use base qw(Bio::DB::NCBIHelper);
Subroutine BEGIN: called CC=1 SCAR=0.0
101 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
102 2 $DEFAULTMODE = 'single';
103 2 $DEFAULTFORMAT = 'gp';
104 2 %PARAMSTRING = (
105 'batch' => { 'db' => 'protein',
106 'usehistory' => 'n',
107 'tool' => 'bioperl'},
108 # no query?
109 'gi' => { 'db' => 'protein',
110 'usehistory' => 'n',
111 'tool' => 'bioperl',
112 'retmode' => 'text'},
113 'version' => { 'db' => 'protein',
114 'usehistory' => 'n',
115 'tool' => 'bioperl',
116 'retmode' => 'text'},
117 'single' => { 'db' => 'protein',
118 'usehistory' => 'n',
119 'tool' => 'bioperl',
120 'retmode' => 'text'},
121 'webenv' => {
122 'query_key' => 'querykey',
123 'WebEnv' => 'cookie',
124 'db' => 'protein',
125 'usehistory' => 'n',
126 'tool' => 'bioperl',
127 'retmode' => 'text'},
128 );
129 }
130  
131 # the new way to make modules a little more lightweight
132 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
133 2 my($class, @args) = @_;
134 2 my $self = $class->SUPER::new(@args);
135 2 $self->request_format($self->default_format);
136 2 return $self;
137 }
138  
139 =head2 get_params
140  
141 Title : get_params
142 Usage : my %params = $self->get_params($mode)
143 Function: Returns key,value pairs to be passed to NCBI database
144 for either 'batch' or 'single' sequence retrieval method
145 Returns : a key,value pair hash
146 Args : 'single' or 'batch' mode for retrieval
147  
148 =cut
149  
150 6 ▶sub get_params {
Subroutine get_params: called CC=2 SCAR=7.6
Pod documented
151 6 my ($self, $mode) = @_;
152 0 ▶ return defined $PARAMSTRING{$mode} ? %{$PARAMSTRING{$mode}} : %{$PARAMSTRING{$DEFAULTMODE}};
Branch: 1 branch
BranchTrueFalseTotal
defined $Bio::DB::GenPept::PARAMSTRING{$mode} ? : 6 0 6
153 }
154  
155 =head2 default_format
156  
157 Title : default_format
158 Usage : my $format = $self->default_format
159 Function: Returns default sequence format for this module
160 Returns : string
161 Args : none
162  
163 =cut
164  
165 20 ▶sub default_format {
Subroutine default_format: called CC=1 SCAR=0.0
Pod documented
166 20 return $DEFAULTFORMAT;
167 }
168  
169 # from Bio::DB::WebDBSeqI from Bio::DB::RandomAccessI
170  
171 =head1 Routines from Bio::DB::WebDBSeqI and Bio::DB::RandomAccessI
172  
173 =head2 get_Seq_by_id
174  
175 Title : get_Seq_by_id
176 Usage : $seq = $db->get_Seq_by_id('P09651.5')
177 Function: Gets a Bio::Seq object by its name
178 Returns : a Bio::Seq object
179 Args : the id (as a string) of a sequence
180 Throws : "id does not exist" exception
181  
182 =head2 get_Seq_by_acc
183  
184 Title : get_Seq_by_acc
185 Usage : $seq = $db->get_Seq_by_acc('AAC73346');
186 Function: Gets a Seq objects by accession number
187 Returns : Bio::Seq object
188 Args : accession number to retrieve by
189  
190 =head1 Routines implemented by Bio::DB::NCBIHelper
191  
192 =head2 get_request
193  
194 Title : get_request
195 Usage : my $url = $self->get_request
196 Function: HTTP::Request
197 Returns :
198 Args : %qualifiers = a hash of qualifiers (ids, format, etc)
199  
200 =head2 get_Stream_by_id
201  
202 Title : get_Stream_by_id
203 Usage : $stream = $db->get_Stream_by_id( [$uid1, $uid2] );
204 Function: Gets a series of Seq objects by unique identifiers
205 Returns : a Bio::SeqIO stream object
206 Args : $ref : a reference to an array of unique identifiers for
207 the desired sequence entries
208  
209 =head2 get_Stream_by_acc (2)
210  
211 Title : get_Stream_by_acc
212 Usage : $seq = $db->get_Stream_by_acc($acc);
213 Function: Gets a series of Seq objects by accession numbers
214 Returns : a Bio::SeqIO stream object
215 Args : $ref : a reference to an array of accession numbers for
216 the desired sequence entries
217 Note : For GenBank, this just calls the same code for get_Stream_by_id()
218  
219 =head2 get_Stream_by_query
220  
221 Title : get_Stream_by_query
222 Usage : $seq = $db->get_Stream_by_query('ROA1_HUMAN');
223 Function: Gets a series of Seq objects by unique display_id
224 Returns : a Bio::SeqIO stream object
225 Args : $ref : display_id to query by
226  
227 =head2 request_format
228  
229 Title : request_format
230 Usage : my $format = $self->request_format;
231 $self->request_format($format);
232 Function: Get/Set sequence format retrieval
233 Returns : string representing format
234 Args : $format = sequence format
235  
236 =cut
237  
238 # override to force format to be GenPept regardless
239 16 ▶sub request_format {
Subroutine request_format: called CC=1 SCAR=0.0
Pod documented
240 16 my ($self) = @_;
241 16 return $self->SUPER::request_format($self->default_format());
242 }
243  
244 2 1;
245 __END__
« GenBank.pm ↑ Summary EntrezGene.pm »