Parsing SwissProt sequences from the net
1
1
Entering edit mode
4.6 years ago
Cil ▴ 10

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

sequence biopython swissprot sec_record • 1.0k views
ADD COMMENT
1
Entering edit mode
4.6 years ago
tamerg ▴ 100

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 COMMENT

Login before adding your answer.

Traffic: 1764 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6