[Bioperl-l] Issues with new Bio::Tools::Run modules for Genemark and Glimmer

Sendu Bala bix at sendu.me.uk
Thu Mar 1 18:06:54 EST 2007


Mark Johnson wrote:
> Now that I'm using _set_from_args() and trying to get all the options 
> and switches working that I never use, it occurs to me that a 4-in-1 
> module for Glimmer2/Glimmer3/GlimmerM/GllimmerHMM is not going to fly 
> due to the options and switches being different.  At this point, I think 
> I'm going to end up with a Genemark module, a Glimmer2 module, and a 
> Glimmer3 module.  Feh. 

I think a 4in1 would still be possible. Presumably at some point you 
know which one you will run, so let the user set everything in the 
single new() even if it doesn't make sense, but then form argument 
strings with

sub _setparams {
   ...
   if ($glimmer2) {
     my $param_string = $self->SUPER::_setparams(
       -params => [@glim2params], -dash => 1);
   }
   elsif ($glimmer3) {
     ...


Or if you want to be stricter in new(), do something like:

sub new {
   my($class, @args) = @_;
   my $self = $class->SUPER::new(@args);

   my ($type) = $self->_rearrange([qw(TYPE)], @args);

   if ($type eq 'glimmer2') }
     $self->_set_from_args(\@args, -methods => [@glim2params],
                                   -create => 1);
   }
   elsif ($type eq ...


You'll have to figure out something yourself if you want to warn about 
the user supplying args that their requested type doesn't use.


All that said, if these Glimmer things are different programs with 
different uses (and not simply different versions of the same thing with 
the same function), by all means make separate modules.


More information about the Bioperl-l mailing list