用Biopython检索Swissprot条目的亚型序列?

2024-06-28 15:28:21 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我有一个蛋白质的异构体,我想检索每一个的序列,我该怎么做呢?在

from Bio import ExPASy
from Bio import SwissProt

accessions = ["Q16620"]

handle = ExPASy.get_sprot_raw(accessions)
record = SwissProt.read(handle)

biopython教程中的这个示例将使用record.sequence检索第一个异构体的序列。在

我发现简单地以uniprot ["Q16620-1", "Q16620-2", "Q16620-3", ...]上列出的异构项的形式列出一个访问列表是行不通的。在


Tags: fromimportgetraw序列蛋白质recordbio
1条回答
网友
1楼 · 发布于 2024-06-28 15:28:21

您可以使用EBML-EBI的Proteins API和几行Python代码。在

这将只给你一个字符串序列,而不是一个成熟的BioPython对象。在

import requests
import xml.etree.ElementTree as ET

accession = "Q16620"

# a dictionary storing the sequence of your isoforms, key: accesion number, value: sequence
isoforms = dict()

# make a call to EBI API
r = requests.get('https://www.ebi.ac.uk/proteins/api/proteins/{}/isoforms'.format(accession))

# parse the returned XML
uniprot = ET.fromstring(r.text)

for isoform in uniprot.getchildren():
    # get the sequence
    seq = isoform.find('{http://uniprot.org/uniprot}sequence')

    # get the accession number
    iso_accession = isoform.find('{http://uniprot.org/uniprot}accession')

    # add the values to the dictionary
    if seq.text and iso_accession.text:
        isoforms[iso_accession.text] = seq.text

相关问题 更多 >