BioPerl
view release on metacpan or search on metacpan
Bio/DB/WebDBSeqI.pm view on Meta::CPAN
($rformat,$ioformat) = $self->request_format();
$self->postprocess_data('type'=> 'string',
'location' => $content);
$self->debug( "str is $$content\n");
return Bio::SeqIO->new('-verbose' => $self->verbose,
'-format' => $ioformat,
'-fh' => new IO::String($$content));
}
# if we got here, we don't know how to handle the retrieval type
$self->throw("retrieval type " . $self->retrieval_type .
" unsupported\n");
}
=head2 url_base_address
Title : url_base_address
Usage : my $address = $self->url_base_address or
$self->url_base_address($address)
Function: Get/Set the base URL for the Web Database
Returns : Base URL for the Web Database
Args : $address - URL for the WebDatabase
=cut
sub url_base_address {
my $self = shift;
my $d = $self->{'_baseaddress'};
$self->{'_baseaddress'} = shift if @_;
$d;
}
=head2 proxy
Title : proxy
Usage : $httpproxy = $db->proxy('http') or
$db->proxy(['http','ftp'], 'http://myproxy' )
Function: Get/Set a proxy for use of proxy
Returns : a string indicating the proxy
Args : $protocol : an array ref of the protocol(s) to set/get
$proxyurl : url of the proxy to use for the specified protocol
$username : username (if proxy requires authentication)
$password : password (if proxy requires authentication)
=cut
sub proxy {
my ($self,$protocol,$proxy,$username,$password) = @_;
return if ( !defined $self->ua || !defined $protocol
|| !defined $proxy );
$self->authentication($username, $password)
if ($username && $password);
return $self->ua->proxy($protocol,$proxy);
}
=head2 authentication
Title : authentication
Usage : $db->authentication($user,$pass)
Function: Get/Set authentication credentials
Returns : Array of user/pass
Args : Array or user/pass
=cut
sub authentication{
my ($self,$u,$p) = @_;
if( defined $u && defined $p ) {
$self->{'_authentication'} = [ $u,$p];
}
return @{$self->{'_authentication'}};
}
=head2 retrieval_type
Title : retrieval_type
Usage : $self->retrieval_type($type);
my $type = $self->retrieval_type
Function: Get/Set a proxy for retrieval_type (pipeline, io_string or tempfile)
Returns : string representing retrieval type
Args : $value - the value to store
This setting affects how the data stream from the remote web server is
processed and passed to the Bio::SeqIO layer. Three types of retrieval
types are currently allowed:
pipeline Perform a fork in an attempt to begin streaming
while the data is still downloading from the remote
server. Disk, memory and speed efficient, but will
not work on Windows or MacOS 9 platforms.
io_string Store downloaded database entry(s) in memory. Can be
problematic for batch downloads because entire set
of entries must fit in memory. Alll entries must be
downloaded before processing can begin.
tempfile Store downloaded database entry(s) in a temporary file.
All entries must be downloaded before processing can
begin.
The default is pipeline, with automatic fallback to io_string if
pipelining is not available.
=cut
sub retrieval_type {
my ($self, $value) = @_;
if( defined $value ) {
$value = lc $value;
if( ! $RETRIEVAL_TYPES{$value} ) {
$self->warn("invalid retrieval type $value must be one of (" .
join(",", keys %RETRIEVAL_TYPES), ")");
$value = $DEFAULT_RETRIEVAL_TYPE;
}
$self->{'_retrieval_type'} = $value;
}
return $self->{'_retrieval_type'};
( run in 1.330 second using v1.01-cache-2.11-cpan-39bf76dae61 )