首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用Biopython检索Swissprot条目的异构体序列?

使用Biopython检索Swissprot条目的异构体序列?
EN

Stack Overflow用户
提问于 2017-10-07 15:33:12
回答 1查看 469关注 0票数 2

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

代码语言:javascript
运行
复制
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", ...]上列出的异构体条目的形式来迭代的访问列表是行不通的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-08 09:00:32

您可以使用EBML的蛋白质API和几行Python代码。

这将只将序列作为字符串提供,而不是作为成熟的BioPython对象。

代码语言:javascript
运行
复制
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:
    # 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
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46621982

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档