【问题标题】:BioPython: How to convert the amino acid alphabet toBioPython:如何将氨基酸字母表转换为
【发布时间】:2013-10-23 21:45:45
【问题描述】:

在讨论如何使用 Bio.SeqIO.parse() 导入序列数据时,BioPython 食谱指出:

有一个可选参数字母表来指定要使用的字母表。这对于像 FASTA 这样的文件格式很有用,否则 Bio.SeqIO 将默认为通用字母表。

如何添加这个可选参数?我有以下代码:

from os.path import abspath
from Bio import SeqIO

handle = open(f_path, "rU")
records = list(SeqIO.parse(handle, "fasta"))
handle.close()

这会从 UniProt 数据库中导入大量 FASTA 文件。问题在于它在通用 SingleLetterAlphabet 类中。如何在 SingleLetterAlphabet 和 ExtendedIUPACProtein 之间进行转换?

最终目标是在这些序列中搜索 GxxxG 等基序。

【问题讨论】:

    标签: python bioinformatics biopython


    【解决方案1】:

    像这样:

    # Import required alphabet
    from Bio.Alphabet import IUPAC
    
    # Pass imported alphabet as an argument for `SeqIO.parse`:
    records = list(SeqIO.parse(handle, 'fasta', IUPAC.extended_protein))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      相关资源
      最近更新 更多