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()
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)
def test_prodoc_html(self): with ExPASy.get_prodoc_entry("PDOC00001") as handle: html = handle.read() self.assertEqual( handle.url, "https://prosite.expasy.org/cgi-bin/prosite/get-prodoc-entry?PDOC00001" ) self.assertIn("{PS00001; ASN_GLYCOSYLATION}", html)
def get_documentation(accession): """ get_documentation function gets as arg : accesion (signature_ac example "PS00001" ) returns html file containing full documentaion """ handle_1 = ExPASy.get_prosite_raw(accession) records = Prosite.read(handle_1) handle_2 = ExPASy.get_prodoc_entry(records.pdoc) #record = Prodoc.read(handle_2)" html = handle_2.read() with open("my_prodoc_record.html", "w") as out_handle: out_handle.write(html)
from Bio import ExPASy handle = ExPASy.get_prosite_raw("PS00001") text = handle.read() print(text) # 가장 원시적인 긁는 방법 (Expasy만 있으면 됨) """from Bio import Prosite handle = ExPASy.get_prosite_raw("PS51036") record = Prosite.read(handle) print(record)""" # ImportError: cannot import name 'Prosite' from 'Bio' (/home/koreanraichu/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/Bio/__init__.py)가 나를 반기는디? from Bio.ExPASy import Prodoc handle = ExPASy.get_prosite_raw("PDOC00001") record = Prodoc.read(handle) print(record) handle = ExPASy.get_prosite_entry("PS51036") html = handle.read() with open("myprositerecord.html", "w") as out_handle: out_handle.write(html) # HTML format으로 다운로드 받을 수 있다. handle = ExPASy.get_prodoc_entry("PDOC51036") html = handle.read() with open("myprositerecord2.html", "w") as out_handle: out_handle.write(html) # 얘는 prodoc 다운로드 하는 코드