def queryProsite(theSeqs): print("Currently querying Prosite...") prositeData = list() for i in theSeqs: handle = ScanProsite.scan(seq=i, skip="0") result = ScanProsite.read(handle) try: handle = ExPASy.get_prosite_entry(result[0]["signature_ac"]) res = handle.read() splitted = res.split("\n") line = 0 for a in range(0, len(splitted)): if splitted[a][0:2] == "DE": line = a prositeData.append(splitted[line][5:-1]) print(splitted[line][5:-1]) except IndexError: prositeData.append(None) print(None) return prositeData
def test_prosite_html(self): handle = ExPASy.get_prosite_entry('PS00001') html = handle.read() self.assertEqual(handle.url, 'http://prosite.expasy.org/cgi-bin/prosite/get-prosite-entry?PS00001') handle.close() self.assertTrue('<title>PROSITE: PS00001</title>' in html)
def test_prosite_html(self): with ExPASy.get_prosite_entry("PS00001") as handle: html = handle.read() self.assertEqual( handle.url, "https://prosite.expasy.org/cgi-bin/prosite/get-prosite-entry?PS00001" ) self.assertIn("<title>PROSITE: PS00001</title>", html)
def __getitem__(self, id): """__getitem__(self, id) -> object Return a Prosite entry. id is either the id or accession for the entry. Raises a KeyError if there's an error. """ from Bio import ExPASy # First, check to see if enough time has passed since my # last query. self.limiter.wait() try: handle = ExPASy.get_prosite_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 __getitem__(self, id): """__getitem__(self, id) -> object Return a Prosite entry. id is either the id or accession for the entry. Raises a KeyError if there's an error. """ from Bio import ExPASy # First, check to see if enough time has passed since my # last query. self.limiter.wait() try: handle = ExPASy.get_prosite_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 testProsite(): handle = ExPASy.get_prosite_entry('PS50943') #está como exemplo ofile = open("test.html", "wb") ofile.write(handle.read()) ofile.close()
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 다운로드 하는 코드