[Bioperl-l] Interface of the method
Jun Yin
jun.yin at ucd.ie
Fri Jun 18 11:05:41 EDT 2010
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
More information about the Bioperl-l
mailing list