[Tutor] Script for Parsing string sequences from a file
Spyros Charonis
s.charonis at gmail.com
Fri Apr 15 14:41:36 CEST 2011
Hello,
I'm doing a biomedical degree and am taking a course on bioinformatics. We
were given a raw version of a public database in a file (the file is in
simple ASCII) and need to extract only certain lines containing important
information. I've made a script that does not work and I am having trouble
understanding why.
when I run it on the python shell, it prompts for a protein name but then
reports that there is no such entry. The first while loop nested inside a
for loop is intended to pick up all lines beginning with "gc;", chop off the
"gc;" part and keep only the text after that (which is a protein name).
Then it scans the file and collects all lines, chops the "gc;" and stores
in them in a tuple. This tuple is not built correctly, because as I posted
when the program is run it reports that it cannot find my query in the tuple
I created and it is certainly in the database. Can you detect what the
mistake is? Thank you in advance!
Spyros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110415/47778e60/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myParser.py
Type: application/octet-stream
Size: 1232 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20110415/47778e60/attachment.obj>
More information about the Tutor
mailing list