0

执行以下代码时:

from Bio.SeqUtils import six_frame_translations

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

我收到以下错误:

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

我正在使用 Python 3.23、Biopython 1.59

有什么建议么?谢谢,

查尔斯

4

1 回答 1

1

It's a bug. Prior to August 11, 2011, the SeqUtils module had a function reverse. It was deprecated in version 1.54, and removed in 1.58.

From the file DEPRECATED:

Function 'reverse' in Bio.SeqUtils was deprecated in Release 1.54, and removed in Release 1.58. Instead just use the string's slice method with a step of minus one.

So, it looks they just failed to make this conversion in six_frame_translations(). You can submit a bug report to the OBF Redmine site, or patch it yourself and submit a pull request to the Biopython repository on GitHub.

If you're feeling especially generous, you might consider writing a unit test to automatically detect failures of this function- it'll help future users like yourself. =)

于 2012-08-29T09:59:05.870 回答