<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,
<br>
<br>
It looks like SwissProt can parse old version uniprot_sprot data
file, but fails with the current version data file. Below is how to
replicate the error (Biopython version is '1.64').
<br>
<br>
Regards,
<br>
<br>
Jinghua
<br>
----------------------
<br>
<br>
First download the current uniprot_sprot data file (~72 MB in size)
at <a class="moz-txt-link-freetext"
href="ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/taxonomic_divisions/uniprot_sprot_human.dat.gz">ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/taxonomic_divisions/uniprot_sprot_human.dat.gz</a>
<br>
<br>
Then in IPython, using SwissProt to parse the downloaded data file:
<br>
<br>
In [1]: from Bio import SwissProt
<br>
<br>
In [2]: import gzip
<br>
<br>
In [3]: inhandle = gzip.open('./uniprot_sprot_human.dat.gz')
<br>
<br>
In [4]: reader = SwissProt.parse(inhandle)
<br>
<br>
In [5]: for r in reader:
<br>
...: pass
<br>
...:
<br>
---------------------------------------------------------------------------
<br>
AssertionError Traceback (most recent
call last)
<br>
<ipython-input-5-c04351d992d2> in <module>()
<br>
----> 1 for r in reader:
<br>
2 pass
<br>
3
<br>
<br>
<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/lib/python2.7/dist-packages/Bio/SwissProt<span
class="moz-txt-tag">/</span></i>__init__.pyc in parse(handle)
<br>
115 def parse(handle):
<br>
116 while True:
<br>
--> 117 record = _read(handle)
<br>
118 if not record:
<br>
119 return
<br>
<br>
<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/lib/python2.7/dist-packages/Bio/SwissProt<span
class="moz-txt-tag">/</span></i>__init__.pyc in _read(handle)
<br>
182 elif key == 'RN':
<br>
183 reference = Reference()
<br>
--> 184 _read_rn(reference, value)
<br>
185 record.references.append(reference)
<br>
186 elif key == 'RP':
<br>
<br>
<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/local/lib/python2.7/dist-packages/Bio/SwissProt<span
class="moz-txt-tag">/</span></i>__init__.pyc in
_read_rn(reference, rn)
<br>
407
<br>
408 def _read_rn(reference, rn):
<br>
--> 409 assert rn[0] == '[' and rn[-1] == ']', "Missing
brackets %s" % rn
<br>
410 reference.number = int(rn[1:-1])
<br>
411
<br>
<br>
AssertionError: Missing brackets [1] {ECO:0000305,
ECO:0000312|EMBL:AAK11482.1}
<br>
<br>
<br>
<br>
</body>
</html>