[Biopython-dev] [Bug 2381] translate and transcibe methods for the Seq object (in Bio.Seq)

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Oct 17 08:01:12 UTC 2007


http://bugzilla.open-bio.org/show_bug.cgi?id=2381





------- Comment #5 from biopython-bugzilla at maubp.freeserve.co.uk  2007-10-17 04:01 EST -------
> Given the various translate functions we already have in
> Biopython, why do you want to add another one? Is there
> something the "translate" method can do that the "translate"
> function cannot? Since the "translate" function can take Seq
> objects as well as simple strings, I'd prefer the "translate"
> function over a "translate" method.

Its a style thing, allowing more of an object orientated coding
style.  For comparison, look at the evolution of the string module
in python which was phased out in favour of string object methods.

In terms of capabilities/arguments, I think the Bio.Seq.translate()
function and the suggested new Bio.Seq.Seq.translate() object
method should be equivalent.  In fact, I would have one call the other
internally.

Currently, if you work with strings, you can use the following nice
concise style:

from Bio import Seq #The module
my_str = "ACTGACCGTGC"
print Seq.translate(my_str)

However, if you want to use Seq objects, this becomes rather a mess (in my
opinion):

from Bio import Seq #The module
from Bio.Alphabet.IUPAC import unambiguous_dna
my_seq = Seq.Seq("ACTGACCGTGC", unambiguous_dna)
print Seq.translate(my_seq)

I would like to be able to do this, using an object method:

from Bio.Seq import Seq
from Bio.Alphabet.IUPAC import unambiguous_dna
my_seq = Seq("ACTGACCGTGC", unambiguous_dna)
print my_seq.translate()

Another bonus for people who think OO, is doing dir(my_seq) would
list these useful methods.  Right now the user has to know to go
looking in the Bio.Seq module for a function.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list