[BioPython] said Your XML file was empty in parsing blast records but can see the results in the saved xml file
Peter
biopython at maubp.freeserve.co.uk
Thu Nov 13 09:14:26 EST 2008
On Thu, Nov 13, 2008 at 1:55 PM, Hongwu Ma <hma2 at staffmail.ed.ac.uk> wrote:
>
> Thanks, Peter. I tried to reopen the xml file and it was working.
Good.
> I also tried to parse the result before reading as below:
> ...
>
> I found I still got the problem, a good xml file but empty blast_records.
> Why the later read() function affect the parse before it?
You can only call handle.read() once - it gives you all the remaining
data in the file. Once you've called handle.read(), any further calls
to handle.read() or handle.readline() etc won't return any more data.
If you call result_handle.read() first, then when you give
result_handle to the parser, it can't get any data from it.
Have a look at reading files in python which should help to explain the ideas:
http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files
Peter
More information about the BioPython
mailing list