Question: Help: Problem With Biopython When Retrieving Sequence Records From Expasy (Solved)
0
gravatar for Peiska
8.7 years ago by
Peiska20
Turku
Peiska20 wrote:

I am doing a BioPython Script that reads IDs from a .txt and retrieves corresponding sequence records from ExPASy service. I just start to program in BioPython a few weeks ago, and I really dont know why this is not working. Can someone help me please?

This is my code:

from Bio import ExPASy

from Bio import SeqIO

openfile = open("idlist.txt", "r")

ids=openfile.readlines()

i=0

while i< len (ids):

handle = ExPASy.get_sprot_raw(ids[i])

seq_record = SeqIO.read(handle, "swiss") #Program crashes here

print seq_record.id
print seq_record.name
print seq_record.description
print repr(seq_record.seq)
print "Length %i" % len(seq_record)
print seq_record.annotations["keywords"]


i+=1

handle.close()

The text file with the IDS has this format and this ids separated by lines:

Q06187 E2RMF7 P35991 Q3ZC95 Q5S255 Q8JH64

biopython programming • 2.5k views
ADD COMMENTlink modified 7.2 years ago by Biostar ♦♦ 20 • written 8.7 years ago by Peiska20
1

Solved: handle = ExPASy.get_sprot_raw(ids[i].strip())

ADD REPLYlink written 8.7 years ago by Peiska20

thanks for sharing a problem and the solution!

ADD REPLYlink written 8.7 years ago by Giovanni M Dall'Olio27k
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: 1699 users visited in the last hour