本文整理汇总了Python中Bio.ExPASy.get_prodoc_entry方法的典型用法代码示例。如果您正苦于以下问题:Python ExPASy.get_prodoc_entry方法的具体用法?Python ExPASy.get_prodoc_entry怎么用?Python ExPASy.get_prodoc_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.ExPASy
的用法示例。
在下文中一共展示了ExPASy.get_prodoc_entry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_prodoc_html
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_prodoc_entry [as 别名]
def test_prodoc_html(self):
handle = ExPASy.get_prodoc_entry('PDOC00001')
html = handle.read()
self.assertEqual(handle.url,
'http://prosite.expasy.org/cgi-bin/prosite/get-prodoc-entry?PDOC00001')
handle.close()
self.assertTrue('{PS00001; ASN_GLYCOSYLATION}' in html)
示例2: __getitem__
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_prodoc_entry [as 别名]
def __getitem__(self, id):
"""__getitem__(self, id) -> object
Return a Prodoc entry. id is either the id or accession
for the entry. Raises a KeyError if there's an error.
"""
import time
from Bio import ExPASy
# First, check to see if enough time has passed since my
# last query.
if self.last_query_time is not None:
delay = self.last_query_time + self.delay - time.time()
if delay > 0.0:
time.sleep(delay)
self.last_query_time = time.time()
try:
handle = ExPASy.get_prodoc_entry(id)
except IOError:
raise KeyError(id)
try:
handle = File.StringHandle(_extract_record(handle))
except ValueError:
raise KeyError(id)
if self.parser is not None:
return self.parser.parse(handle)
return handle.read()