Bioperl: Bio::Root::RootI::_rearrange

Steve Chervitz sac@neomorphic.com (Steve A. Chervitz)
Tue, 6 Jun 2000 10:58:36 -0700 (PDT)


hilmar.lapp@pharma.Novartis.com writes:
 > 
 > I may be completely wrong with the following due to my limited experience with
 > bioperl, and if so, please ignore.
 > 
 > Given the case that a subclass introduces some additional parameters. In the
 > initialization method of that subclass you would now call _rearrange() with all
 > arguments passed and the parameter names you're interested in,  i.e., those of
 > the additional ones. You wouldn't specify the parameters of the inherited class'
 > initialization, because that class is supposed to be able to handle these itself
 > at best. So, both initialization methods would call _rearrange(), and both would
 > get an exception (the parent because it doesn't know that the additional
 > parameters are allowed).

Yes, this is the way _rearrange() was intended to be used. This sort
of parameter selection scheme can work horizontally as well as
vertically. You can pass a long parameter list around to several
different methods within the same object, and each one takes the
parameters in which they are interested. I know some modules do this
currently. 

It would be a good idea to add a note about this to the usage pod for
_rearrage(). Volunteers?

Steve

 > I think this is already used this way in BioPerl itself, and I've written
 > something that works this way. So, I'm not sure: would this be incorrect code
 > then, or would you rather indeed break code with the modification you are
 > suggesting?
 > 
 > Cheers,
 > 
 >      Hilmar
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > James Gilbert <jgrg@sanger.ac.uk> on 06.06.2000 14:40:05
 > 
 > To:   Bioperl <vsns-bcd-perl@lists.uni-bielefeld.de>
 > cc:    (bcc: HILMAR LAPP/PH/Novartis)
 > 
 > Subject:  Bioperl: Bio::Root::RootI::_rearrange
 > 
 > 
 > 
 > 
 > 
 > 
 > The Bio::Root::RootI::_rearrange method, which is
 > used to parse arguments like:
 > 
 >      $obj = Class->new(
 >          -id => 'foo',
 >          -seq => 'acatgctagagctagcatcgacgatg',
 >          );
 > 
 > doesn't do anything if you pass invalid options
 > (if, for example, "seq" isn't a valid option for
 > the "new" method above).  I think it should throw
 > an exception.  Does anyone object if I add this?
 > I can't see that it will break anything, unless
 > someone relies on this behaviour.
 > 
 >      James
 > 
 > James G.R. Gilbert
 > The Sanger Centre
 > Wellcome Trust Genome Campus
 > Hinxton
 > Cambridge                        Tel: 01223 494906
 > CB10 1SA                         Fax: 01223 494919
 > 
 > =========== Bioperl Project Mailing List Message Footer =======
 > Project URL: http://bio.perl.org/
 > For info about how to (un)subscribe, where messages are archived, etc:
 > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
 > ====================================================================
 > 
 > 
 > 
 > 
 > =========== Bioperl Project Mailing List Message Footer =======
 > Project URL: http://bio.perl.org/
 > For info about how to (un)subscribe, where messages are archived, etc:
 > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
 > ====================================================================
 > 
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================