Question: Trouble Calling Biopython Sequtils Six_Frame_Translations
0
gravatar for charles.bridges
20 months ago by
charles.bridges60 wrote:

Hi, when executing the following code:

from Bio.SeqUtils import six_frame_translations

blah = six_frame_translations("ATCGATCGATCG")
print(blah)

I get the following error:

File "C:\Python32\lib\site-packages\Bio\SeqUtils\__init__.py", line 263, in six_frame_translations
    frames[-(i+1)] = reverse(translate(anti[i:], genetic_code))
NameError: global name 'reverse' is not defined

I am using Python 3.23, Biopython 1.59

Any suggestions? Thanks,

Charles

ADD COMMENTlink written 20 months ago by charles.bridges60

the reverse function is broken in Python 3.X, BioPython has a reverse_complement function (http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc23) and the translation function (http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc25) so you can easily built a function to call all six frames and produce the respective translations.

ADD REPLYlink written 20 months ago by JC4.8k
1
gravatar for Peter
20 months ago by
Peter3.8k
Scotland, UK
Peter3.8k wrote:

This isn't simply a Python 3 problem, just a bug - we removed the 'reverse' function but didn't notice the sixframetranslation function was still using it. Fix here: https://github.com/biopython/biopython/commit/d2ed4f2254938517ccd7843ce8db810d6fe91ab9

That then revealed a more subtle integer vs float problem under Python 3, fix here: https://github.com/biopython/biopython/commit/acf0b9a80718ba9c39f8deb9a23073e98f7fe3e4

P.S. Duplicate question here: http://stackoverflow.com/questions/12165791/trouble-calling-biopython-sequtils-six-frame-translations

ADD COMMENTlink modified 20 months ago • written 20 months ago by Peter3.8k
1
0
gravatar for Istvan Albert
20 months ago by
Istvan Albert ♦♦ 39k
University Park, USA
Istvan Albert ♦♦ 39k wrote:

Use Python 2.7 for BioPython - the software is not fully supported for the Python 3 branch.

ADD COMMENTlink written 20 months ago by Istvan Albert ♦♦ 39k

Is there a method to 'revert' to python 2.7 from 3.23? Will I lose any functionality? What about script syntax?

ADD REPLYlink written 20 months ago by charles.bridges60

you will not lose any functionality nor will it overwrite anything, just install python 2.7 and once you do make sure to invoke the right version of python when you use it

ADD REPLYlink written 20 months ago by Istvan Albert ♦♦ 39k

Perhaps it would be easier to find another module (or even another external program such as EMBOSS) to translate my sequences?

ADD REPLYlink written 20 months ago by charles.bridges60
1

Emboss has sixpack for that: http://emboss.sourceforge.net/apps/cvs/emboss/apps/sixpack.html

ADD REPLYlink written 20 months ago by JC4.8k

This isn't actually a Python 3 issue - the same problem happens on Python 2 as well :(

ADD REPLYlink written 20 months ago by Peter3.8k
0
gravatar for charles.bridges
20 months ago by
charles.bridges60 wrote:

Thanks for helping me with that issue! Of course, here's another one:

The output format of sixframetranslations is not very helpful for what I'm doing; the output format currently is a "rolling" translation, if you will, and I need them in a "fasta-formatted" orientation. I would like the output format as follows:

>Seq1_Frame_-1
LMNOP
>Seq1_Frame_-2
NOPQR
>Seq1_Frame_-3
OPQRS
....
>Seq2_Frame_-1
ABCDE
>Seq2_Frame_-2
BCDEF

etc. Any ideas??

ADD COMMENTlink modified 20 months ago • written 20 months ago by charles.bridges60
Please log in to add an answer.

Help
Access
  • RSS
  • Stats
  • API

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.0.0
Traffic: 533 users visited in the last hour