[Bioperl-l] Interface of the method

Chris Fields cjfields at illinois.edu
Fri Jun 18 15:26:33 UTC 2010


Jun,

Have to go back and see what 'toggle' does, but beyond that changing it works for me.  

Just to note, if this is a change directly in Bio::SimpleAlign or a modification of the Bio::Align::AlignI interface we will need to add deprecation warnings to the older methods (can't just remove them).  If this a newer interface then it won't be as much of a problem, but we also can't just change Bio::AlignIO to return these instead.  

We can now easily do this so they go off with a predetermined minor version of Bio::Root::Root, see Bio::SimpleAlign::no_sequences/num_sequences for an example using deprecated().  

(Note: At some point this deprecated may need to be modified to rely more on the module's version number, such as cases where we split off code and it will need a separate numbering scheme.  But for now it works).

chris

On Jun 18, 2010, at 10:05 AM, Jun Yin wrote:

> Hi, Chris,
> 
> Ok, I see. Then it is better to support a call of the method like:
> 
> $newaln=$aln->select_Seqs('-seqs' => [1, 3, 5..10,15], -toggle => "yes");
> and,
> $newaln=$aln->select_Seqs([1, 3, 5..10,15]);
> 
> But '-seqs' doesnot sound very good, I will prefer '-orders'.
> 
> Jun Yin
> Ph.D. student in U.C.D.
> 
> Bioinformatics Laboratory
> Conway Institute
> University College Dublin
> 
> 
> -----Original Message-----
> From: Chris Fields [mailto:cjfields at illinois.edu] 
> Sent: Friday, June 18, 2010 2:42 PM
> To: Jun Yin
> Cc: 'Dave Messina'; bioperl-l at lists.open-bio.org
> Subject: Re: [Bioperl-l] Interface of the method
> 
> Jun, 
> 
> It all depends on optimization.  I like the named argument version myself.
> The current bioperl named parameters implementation requires, in order to
> parse out the named parameters, you have to call either the core
> _rearrange() method or Lincoln's rearrange() utility for consistency (deals
> with all sorts of variants, and Lincoln's allows aliases).  Either way is a
> small hit, which is fine in most cases, but if the method is called possibly
> thousands of times it amplifies accordingly and may become a bottleneck on
> speed.  
> 
> You could have your cake and eat it too; check if the first argument is an
> arrayref and do it it the original way, otherwise use rearrange().  
> 
> BTW, this won't work:
> 
> '-seqs' => (1, 3, 5..10,15), -toggle => "yes"
> 
> The list flattens out into this:
> 
> '-seqs', 1, 3, 5, 6, 7, 8, 9, 10, 15, -toggle, "yes" (12 elems) 
> 
> So they don't pair up as you would expect; this is a silent bug, as
> rearrange() will happily assign 1 to 'seqs' and toss the rest unless they
> are asked for.  With and odd number of elements you would see warnings
> popping up.
> 
> You'll have to use arrayrefs to get proper name-value pairings:
> 
> '-seqs', [ 1, 3, 5, 6, 7, 8, 9, 10, 15], -toggle, "yes" (4 elems)
> 
> chris
> 
> On Jun 18, 2010, at 5:47 AM, Jun Yin wrote:
> 
>> Hi, Dave,
>> 
>> No problem. I think your suggestion of using 
>> $newaln=$aln->select_Seqs('-seqs' => (1, 3, 5..10,15), -toggle => "yes"); 
>> is more reasonable. It is a more BioPerl way of defined parameters.
>> 
>> And, $newaln=$aln->select_Seqs(1, 3, 5..10,15); 
>> will also be recognized for the simplicity of use.
>> 
>> Cheers,
>> Jun Yin
>> Ph.D. student in U.C.D.
>> 
>> Bioinformatics Laboratory
>> Conway Institute
>> University College Dublin
>> 
>> 
>> -----Original Message-----
>> From: bioperl-l-bounces at lists.open-bio.org
> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Dave Messina
>> Sent: Friday, June 18, 2010 10:38 AM
>> To: Jun Yin
>> Cc: bioperl-l at lists.open-bio.org
>> Subject: Re: [Bioperl-l] Interface of the method
>> 
>> Hi Jun,
>> 
>> 
>>> In the BioPerl guide,
>>> http://www.bioperl.org/wiki/Advanced_BioPerl
>>> 
>>> They say that, Capital word should be used for methods returning  
>>> objects,
>> 
>> You're absolutely right. My apologies — thanks for pointing that out.
>> 
>> 
>>> Thus an array reference
>>> [1,3,5..10] seems better than a list (1,3,5..10),
>>> the latter will be hard to recognize the other parameters.
>> 
>> 
>>> 
>> Aaand, you're right here, too.
>> 
>> Again, sorry about that. It was quite late last night when I was  
>> replying to your email, and I sure wasn't thinking clearly.
>> 
>> So, please don't mind me, ( carry on, as you were!) and thanks again  
>> for your work on this.
>> 
>> 
>> Dave 
>> 
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>> 
>> 
>> __________ Information from ESET Smart Security, version of virus
> signature database 5099 (20100509) __________
>> 
>> The message was checked by ESET Smart Security.
>> 
>> http://www.eset.com
>> 
>> 
>> 
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> 
> __________ Information from ESET Smart Security, version of virus signature
> database 5099 (20100509) __________
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> 
> __________ Information from ESET Smart Security, version of virus signature
> database 5099 (20100509) __________
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list