Question: Parsing SwissProt sequences from the net
gravatar for Cil
6 months ago by
Cil10 wrote:

Hi all,

right now I am getting into the basics of Biopython, working through the Tutorial.

5.3.2 Parsing SwissProt sequences from the net

In this chapter following piece of code doesn't work for me:

from Bio import ExPASy

from Bio import SeqIO

with ExPASy.get_sprot_raw("O23729") as handle:

    seq_record =, "swiss")



print("Length %i" % len(seq_record))


This is what I get at the very beginning and end of the error message:

AssertionError                            Traceback (most recent call last)

<ipython-input-2-87002128e48c> in <module>

      2 from Bio import SeqIO

      3 with ExPASy.get_sprot_raw("O23729") as handle:

----> 4     seq_record =, "swiss")




AssertionError:                 /note="Chalcone synthase 3"

I am a beginner so please bear with me :). I think the file can actually be obtained from ExPASy but

seq_record =, "swiss")

is where the problem starts Why is it not possible to get seq_record objects from the ExPASy file, do I have to change the function? When I use SeqIO.parse() this error returns:

AttributeError: 'generator' object has no attribute 'id'

Hope to get this solved with your help, folks! Keep it up



ADD COMMENTlink modified 6 months ago by tamerg90 • written 6 months ago by Cil10
gravatar for tamerg
6 months ago by
tamerg90 wrote:


It seems that problem is not on your side. As of latest Biopython 1.76, Biopython hasn't applied data format changes announced by Uniprot. I have seen some implementation in Biopython repository but not a release includes those changes. You may think to try their development version or skip this part.

ADD COMMENTlink written 6 months ago by tamerg90
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1984 users visited in the last hour