~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/DB/GenBank.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: GenBank.pm,v 1.50 2003/07/03 12:29:15 heikki Exp $
 
1
# $Id: GenBank.pm,v 1.59.4.1 2006/10/02 23:10:14 sendu Exp $
2
2
#
3
3
# BioPerl module for Bio::DB::GenBank
4
4
#
56
56
    # also don't want features, just sequence so let's save bandwith
57
57
    # and request Fasta sequence
58
58
    $gb = new Bio::DB::GenBank(-retrievaltype => 'tempfile' , 
59
 
                               -format => 'Fasta');
 
59
                                              -format => 'Fasta');
60
60
    my $seqio = $gb->get_Stream_by_acc(['AC013798', 'AC021953'] );
61
61
    while( my $clone =  $seqio->next_seq ) {
62
62
      print "cloneid is ", $clone->display_id, " ", 
64
64
    }
65
65
    # note that get_Stream_by_version is not implemented
66
66
 
 
67
    # don't want the entire sequence or more options
 
68
    my $gb = Bio::DB::GenBank->new(-format     => 'Fasta',
 
69
                                   -seq_start  => 100,
 
70
                                   -seq_stop   => 200,
 
71
                                   -strand     => 1,
 
72
                                   -complexity => 4));
 
73
    my $seqi = $gb->get_Stream_by_query($query);
 
74
 
 
75
These alternate methods are described at
 
76
L<http://www.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html>
 
77
 
 
78
NOTE: strand should be 1 for plus or 2 for minus.
 
79
 
 
80
Complexity: gi is often a part of a biological blob, containing other gis
 
81
 
 
82
complexity regulates the display:
 
83
0 - get the whole blob
 
84
1 - get the bioseq for gi of interest (default in Entrez)
 
85
2 - get the minimal bioseq-set containing the gi of interest
 
86
3 - get the minimal nuc-prot containing the gi of interest
 
87
4 - get the minimal pub-set containing the gi of interest
 
88
 
 
89
'seq_start' and 'seq_stop' will not work when setting complexity to any value
 
90
other than 1.  'strand' works for any setting other than a complexity of 0
 
91
(whole glob); when you try this with a GenBank return format nothing happens,
 
92
whereas using FASTA works but causes display problems with the other sequences
 
93
in the glob.  As Tao Tao says from NCBI, "Better left it out or set it to 1."
 
94
 
67
95
=head1 DESCRIPTION
68
96
 
69
 
Allows the dynamic retrieval of Sequence objects (Bio::Seq) from the
 
97
Allows the dynamic retrieval of L<Bio::Seq> sequence objects from the
70
98
GenBank database at NCBI, via an Entrez query.
71
99
 
72
 
WARNING: Please do NOT spam the Entrez web server with multiple
 
100
WARNING: Please do B<NOT> spam the Entrez web server with multiple
73
101
requests.  NCBI offers Batch Entrez for this purpose.
74
102
 
75
103
Note that when querying for GenBank accessions starting with 'NT_' you
91
119
Bioperl modules. Send your comments and suggestions preferably to one
92
120
of the Bioperl mailing lists. Your participation is much appreciated.
93
121
 
94
 
  bioperl-l@bioperl.org              - General discussion
95
 
  http://bioperl.org/MailList.shtml  - About the mailing lists
 
122
  bioperl-l@bioperl.org                  - General discussion
 
123
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
96
124
 
97
125
=head2 Reporting Bugs
98
126
 
99
127
Report bugs to the Bioperl bug tracking system to help us keep track
100
 
the bugs and their resolution.  Bug reports can be submitted via email
101
 
or the web:
 
128
the bugs and their resolution.  Bug reports can be submitted via the
 
129
web:
102
130
 
103
 
  bioperl-bugs@bio.perl.org
104
 
  http://bugzilla.bioperl.org/
 
131
  http://bugzilla.open-bio.org/
105
132
 
106
133
=head1 AUTHOR - Aaron Mackey, Jason Stajich
107
134
 
120
147
 
121
148
package Bio::DB::GenBank;
122
149
use strict;
123
 
use vars qw(@ISA %PARAMSTRING $DEFAULTFORMAT $DEFAULTMODE);
124
 
use Bio::DB::NCBIHelper;
 
150
use vars qw(%PARAMSTRING $DEFAULTFORMAT $DEFAULTMODE);
125
151
 
126
 
@ISA = qw(Bio::DB::NCBIHelper);
 
152
use base qw(Bio::DB::NCBIHelper);
127
153
BEGIN {    
128
154
    $DEFAULTMODE   = 'single';
129
 
    $DEFAULTFORMAT = 'gp';
130
 
    %PARAMSTRING = ( 
131
 
                     'batch' => { 'db'     => 'nucleotide',
 
155
    $DEFAULTFORMAT = 'gbwithparts';
 
156
    %PARAMSTRING = (
 
157
                         'batch' => { 'db'     => 'nucleotide',
132
158
                                  'usehistory' => 'n',
133
 
                                  'tool'   => 'bioperl',
134
 
                                  'retmode' => 'text'},
 
159
                                  'tool'   => 'bioperl'},
135
160
                     'query' => { 'usehistory' => 'y',
136
161
                                  'tool'   => 'bioperl',
137
162
                                  'retmode' => 'text'},
147
172
                                   'usehistory' => 'n',
148
173
                                   'tool'   => 'bioperl',
149
174
                                   'retmode' => 'text'},
 
175
                         'webenv' => {    
 
176
                                  'query_key'  => 'querykey',
 
177
                                  'WebEnv'  => 'cookie',
 
178
                                  'db'     => 'nucleotide',
 
179
                                  'usehistory' => 'n',
 
180
                                  'tool'   => 'bioperl',
 
181
                                  'retmode' => 'text'},
150
182
                     );
151
183
}
152
184
 
208
240
  Note    : For GenBank, this just calls the same code for get_Seq_by_id()
209
241
  Throws  : "id does not exist" exception
210
242
 
211
 
=cut
212
 
 
213
 
 
214
 
sub get_Seq_by_acc {
215
 
   my ($self,$seqid) = @_;
216
 
   $self->SUPER::get_Seq_by_acc("gb|$seqid");
217
 
}
218
 
 
219
243
=head2 get_Seq_by_gi
220
244
 
221
245
 Title   : get_Seq_by_gi
305
329
 Returns : 
306
330
 Args    : %qualifiers = a hash of qualifiers (ids, format, etc)
307
331
 
 
332
=cut
 
333
 
 
334
=head2 default_format
 
335
 
 
336
 Title   : default_format
 
337
 Usage   : my $format = $self->default_format
 
338
 Function: Returns default sequence format for this module
 
339
 Returns : string
 
340
 Args    : none
 
341
 
 
342
=cut
 
343
 
 
344
sub default_format {
 
345
    return $DEFAULTFORMAT;
 
346
}
 
347
 
308
348
1;
309
349
__END__