如果我有一种含异构体的蛋白质,并且我想检索每种蛋白质的序列,我该怎么做呢?
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", ...]
上列出的isoform条目的形式制作一份加入的列表是不行的。
答案 0 :(得分:1)
您可以使用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