[Biopython] Translation of partial codons

Martin Mokrejs mmokrejs at fold.natur.cuni.cz
Thu Mar 21 16:56:20 UTC 2013



Iddo Friedberg wrote:
> Perhaps raising an exceptiob should be the default behavior. But I suggest the user can pass an argument lenghtcheck=False. In that case, an exception will not be raised.


But if somebody has to adjust an existing python code and add the extra argument, it is better
to make the check in his/her code right away, and either prepend/append N's to the string,
or whatever else. I don't see much sense to introduce the extra argument at all. Existing
code will break for good, and those affected will just fix their code. ;)

Normally I wouldn't be so sure but in this case I am really fond of raising an exception.
If the character is missing in front of the string due to 

s = myseq[start:stop]

while user hasn't realized for slicing one has to adjust to

s = myseq[start-1:stop]

, a typical error I bet, then these people will just be glad to hit the exception, finally.
;-) Getting an answer in a wrong reading frame is really bad.


Those who had one or two letters less on the right end won't care, except maybe when they realized
they have lost the trailing nucleotide somewhere. Again, I bet a slicing issue will be the
upstream problem.

Martin

> 
> Iddo Friedberg
> http://iddo-friedberg.net/contact.html
> 
>> On Mar 21, 2013 12:38 PM, "Peter Cock" <p.j.a.cock at googlemail.com <mailto:p.j.a.cock at googlemail.com>> wrote:
>>
>> On Thu, Mar 21, 2013 at 4:24 PM, Martin Mokrejs
>> <mmokrejs at fold.natur.cuni.cz <mailto:mmokrejs at fold.natur.cuni.cz>> wrote:
>> >
>> > I agree tha...
>>
>> So that's a +1 for an explicit error from Martin.
>>
>> Similarly Pete Thorpe (off list) agreed an error would be useful, but
>> suggested a new option to specifically request the current behaviour.
>>
>> Thanks,
>>
>> Peter
>>
>> _______________________________________________
>> Biopython mailing list - Biopython at lists.open-bio....
>>



More information about the Biopython mailing list