40
40
Bioperl modules. Send your comments and suggestions preferably to
41
41
the Bioperl mailing list. Your participation is much appreciated.
43
bioperl-l@bioperl.org - General discussion
44
http://bioperl.org/MailList.shtml - About the mailing lists
43
bioperl-l@bioperl.org - General discussion
44
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46
46
=head2 Reporting Bugs
48
48
Report bugs to the Bioperl bug tracking system to help us keep track
49
of the bugs and their resolution. Bug reports can be submitted via
49
of the bugs and their resolution. Bug reports can be submitted via the
52
bioperl-bugs@bioperl.org
53
http://bugzilla.bioperl.org/
52
http://bugzilla.open-bio.org/
57
Heikki Lehvaslaiho (heikki@ebi.ac.uk)
56
Heikki Lehvaslaiho (heikki-at-bioperl-dot-org)
189
184
sub get_seq_stream {
190
my ($self, %qualifiers) = @_;
191
my ($rformat, $ioformat) = $self->request_format();
193
foreach my $key ( keys %qualifiers ) {
194
if( $key =~ /format/i ) {
195
$rformat = $qualifiers{$key};
185
my ($self, %qualifiers) = @_;
186
my ($rformat, $ioformat) = $self->request_format();
188
foreach my $key ( keys %qualifiers ) {
189
if( $key =~ /format/i ) {
190
$rformat = $qualifiers{$key};
199
$qualifiers{'-format'} = $rformat if( !$seen);
200
($rformat, $ioformat) = $self->request_format($rformat);
194
$qualifiers{'-format'} = $rformat if( !$seen);
195
($rformat, $ioformat) = $self->request_format($rformat);
202
my $request = $self->get_request(%qualifiers);
204
if( $self->retrieval_type =~ /temp/i ) {
205
my $dir = $self->io()->tempdir( CLEANUP => 1);
206
my ( $fh, $tmpfile) = $self->io()->tempfile( DIR => $dir );
208
my ($resp) = $self->_request($request, $tmpfile);
209
if( ! -e $tmpfile || -z $tmpfile || ! $resp->is_success() ) {
210
$self->throw("WebDBSeqI Error - check query sequences!\n");
197
my $request = $self->get_request(%qualifiers);
199
if ( $self->retrieval_type =~ /temp/i ) {
200
my $dir = $self->io()->tempdir( CLEANUP => 1);
201
my ( $fh, $tmpfile) = $self->io()->tempfile( DIR => $dir );
203
my ($resp) = $self->_request($request, $tmpfile);
204
if( ! -e $tmpfile || -z $tmpfile || ! $resp->is_success() ) {
205
$self->throw("WebDBSeqI Error - check query sequences!\n");
207
$self->postprocess_data('type' => 'file',
208
'location' => $tmpfile);
209
# this may get reset when requesting batch mode
210
($rformat,$ioformat) = $self->request_format();
211
if ( $self->verbose > 0 ) {
212
open(my $ERR, "<", $tmpfile);
213
while(<$ERR>) { $self->debug($_);}
215
$stream = new Bio::Biblio::IO('-format' => $ioformat,
216
'-file' => $tmpfile);
217
} elsif ( $self->retrieval_type =~ /io_string/i ) {
218
my ($resp) = $self->_request($request);
219
my $content = $resp->content_ref;
220
$self->debug( "content is $$content\n");
221
if( ! $resp->is_success() || length(${$resp->content_ref()}) == 0 ) {
222
$self->throw("WebDBSeqI Error - check query sequences!\n");
224
($rformat,$ioformat) = $self->request_format();
225
$self->postprocess_data('type'=> 'string',
226
'location' => $content);
227
$stream = new Bio::Biblio::IO('-format' => $ioformat,
228
# '-data' => "<tag>". $$content. "</tag>");
232
$self->throw("retrieval type " . $self->retrieval_type .
212
$self->postprocess_data('type' => 'file',
213
'location' => $tmpfile);
214
# this may get reset when requesting batch mode
215
($rformat,$ioformat) = $self->request_format();
216
if( $self->verbose > 0 ) {
217
open(ERR, "<$tmpfile");
218
while(<ERR>) { $self->debug($_);}
220
$stream = new Bio::Biblio::IO('-format' => $ioformat,
221
'-file' => $tmpfile);
222
} elsif( $self->retrieval_type =~ /io_string/i ) {
223
my ($resp) = $self->_request($request);
224
my $content = $resp->content_ref;
225
$self->debug( "content is $$content\n");
226
if( ! $resp->is_success() || length(${$resp->content_ref()}) == 0 ) {
227
$self->throw("WebDBSeqI Error - check query sequences!\n");
229
($rformat,$ioformat) = $self->request_format();
230
$self->postprocess_data('type'=> 'string',
231
'location' => $content);
232
$stream = new Bio::Biblio::IO('-format' => $ioformat,
233
# '-data' => "<tag>". $$content. "</tag>");
237
$self->throw("retrieval type " . $self->retrieval_type .
258
253
# override it with their own method.
260
255
sub postprocess_data {
261
my ($self, %args) = @_;
263
my $type = uc $args{'type'};
264
my $location = $args{'location'};
265
if( !defined $type || $type eq '' || !defined $location) {
267
} elsif( $type eq 'STRING' ) {
269
} elsif ( $type eq 'FILE' ) {
270
open(TMP, $location) or $self->throw("could not open file $location");
273
$data = join("", @in);
276
$data = "<tag>". $data. "</tag>";
278
if( $type eq 'FILE' ) {
279
open(TMP, ">$location") or $self->throw("could overwrite file $location");
282
} elsif ( $type eq 'STRING' ) {
283
${$args{'location'}} = $data;
286
$self->debug("format is ". $self->request_format(). " data is $data\n");
256
my ($self, %args) = @_;
258
my $type = uc $args{'type'};
259
my $location = $args{'location'};
260
if( !defined $type || $type eq '' || !defined $location) {
262
} elsif( $type eq 'STRING' ) {
264
} elsif ( $type eq 'FILE' ) {
265
open($TMP, "<", $location) or $self->throw("could not open file $location");
267
$data = join("", @in);
270
if( $type eq 'FILE' ) {
271
open($TMP, ">", $location) or $self->throw("could overwrite file $location");
273
} elsif ( $type eq 'STRING' ) {
274
${$args{'location'}} = $data;
277
$self->debug("format is ". $self->request_format(). " data is $data\n");
293
280
=head2 VERSION and Revision
295
282
Usage : print $Bio::DB::Biblio::biofetch::VERSION;