Help: Problem With Biopython When Retrieving Sequence Records From Expasy (Solved)
0
0
Entering edit mode
12.2 years ago
Peiska ▴ 20

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 • 3.1k views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

thanks for sharing a problem and the solution!

ADD REPLY

Login before adding your answer.

Traffic: 1990 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