[Bioperl-l] Auto-method caller proposal

Sendu Bala bix at sendu.me.uk
Thu Jan 4 16:00:45 UTC 2007


Hilmar Lapp wrote:
> Sounds good to me, except that I'm still not sure that dashed and 
> dash-less parameters are just variations of the same. What about 
> -verbose and a verbose parameter for the tool, for example?

That's an open problem. I identified it in a recent thread as one of the 
few reasons a run-wrapper module might deliberately demand dashless args 
for program args and only allow dashed args for Bioperl args. The 
consensus (and I agree) was that it is preferable to allow dashed args 
for everything regardless of this problem.

For this proposal, Bio::Root::Root's verbose() would be set for both 
dashed and dashless, and then it would be up to the run-wrapper module 
author to figure out some extra way to set a verbose option 
independently for the program being wrapped. I imagine the author might 
apologise in their POD and tell the user they had to use 
'program_verbose' or something, then handle things appropriately when it 
comes time to create the argument string for passing to the program.

Alternatively (not something I recommend since it will causes confusion 
and mistakes), you could deliberately request problem cases be dashed or 
undashed:

package Bio::Tools::Run::Confusing;
=head2 new
  ...
  To set Bioperl verbosity use:
  -verbose => int
  To activate program verbosity use:
  verbose => 1
=cut
sub new {
   my ($class, @args) = @_;
   my $self = $class->SUPER::new(@args); # Bioperl verbosity set here

   my %args = @args;
   if (my $program_verbose = $args{verbose}) {
     delete $args{verbose};
     $args{program_verbose} = $program_verbose;
   }

   $self->_set_from_args(\%args,
                         -methods => [id score program_verbose],
                         -create => 1);

   return $self;
}
1;

# test code
my $factory = Bio::Tools::Run::Confusing->new(-verbose => 0,
                                               verbose => 1);
is $factory->verbose, 0, 'Bioperl verbosity set correctly';
is $factory->program_verbose, 1, 'program verbosity set correctly';



Any other ideas?



More information about the Bioperl-l mailing list