首页 > 解决方案 > Bio.Alphabet _verify_alphabet 函数现在位于哪里?

问题描述

由于Bio.Alphabet 最近迁移Bio.Seq,我想了解_verify_alphabet函数现在所在的位置。

我也可以完全重写该函数,但由于我只是在更新旧的 python 代码,我更愿意使用已经发布的东西。

谢谢您的支持

标签: pythonbioinformaticsbiopython

解决方案


恐怕Bio.Alphabet没有迁移,它已被弃用,现在已在 Biopython 1.78 中完全删除。这是旧的源代码_verify_alphabet幸运的是,您可以轻松地模拟该功能:

def _verify_alphabet(sequence, alphabet):
    alphabet = set(alphabet) 
    return all(letter in alphabet for letter in sequence)

print(_verify_alphabet("AATGC", "ATCG"))
print(_verify_alphabet("AATUC", "ATCG"))

推荐阅读