Question: Parsing SwissProt sequences from the net
1
gravatar for Cil
6 months ago by
Cil10
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 = SeqIO.read(handle, "swiss")

printseq_record.id)

printseq_record.name)

print(seq_record.description)

print(repr(seq_record.seq))

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

print(seq_record.annotations["keywords"])

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 = SeqIO.read(handle, "swiss")

      5 printseq_record.id)

      6 printseq_record.name)

...

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 = SeqIO.read(handle, "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 SeqIO.read() 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

Best,

Cil

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

Hi,

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.

Help
Access

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