[Bioperl-l] not specifying some parameters to reset_parameters (Bio::DB::EUtilities)

Chris Fields cjfields at illinois.edu
Sat Jun 5 20:09:37 UTC 2010


On Jun 5, 2010, at 10:44 AM, Peng Yu wrote:

> The following problem generate exceptions, because certain parameters
> are not passed to reset_parameters. However, I think that it is
> reasonable to avoid setting any parameters that have already been set
> using new(). If my understand is correct, I'd suggest that
> reset_parameters should only take parameters that need to be reset but
> not to take parameters that don't have be reset.

You need to use set_parameters() to carry over parameters to subsequent searches.  Just as the name of the method implies, reset_parameters() resets pretty much everything, then sets what you pass, and is necessary between certain steps to ensure you aren't carrying over parameters that cause problems when switching eutils if using the same instance (this used to be a problem with elink in particular).  I may add an exception for email and tool parameters as a convenience for the obvious reasons.

However, changing the below to set_parameters() works for me.

> #!/usr/bin/env perl
> 
> use strict;
> use warnings;
> 
> use Bio::DB::EUtilities;
> 
> my $factory = Bio::DB::EUtilities->new(-eutil => 'esearch',
>  -db => 'protein',
>  -term => 'BRCA1 AND human',
>  -email => 'mymail at foo.bar',
> );
> 
> print "get_retmax(): ",$factory->get_retmax(),"\n";
> my $count=$factory->get_count;
> print "count: ",$count,"\n";
> 
> $factory->reset_parameters(-eutil => 'esearch',
> #  -db => 'protein',
> #  -term => 'BRCA1 AND human',
> #  -email => 'mymail at foo.bar',
>  -retmax => $count
> );
> 
> print "get_retmax(): ",$factory->get_retmax(),"\n";
> 
> 
> -- 
> Regards,
> Peng


chris



More information about the Bioperl-l mailing list