Can Biopython Parse Gzipped Xml From Blast?
1
1
Entering edit mode
12.8 years ago
Karthik ▴ 20

I have been using blast+ with the xml output format (-m7 in the older days, and outfmt 5 with ncbi-blast+). Since the XML files are huge, I have been gzipping them. I have also been using Biopython to parse the XML files. Is there a way to handle the gzipped file directly in (Bio)python?

Presently, I

gunzip output.xml.gz
and use something like:

from Bio.Blast import NCBIXML  
blast_file = open ('output.xml')
blast_records = NCBIXML.parse(blast_file)

Thanks!

blast xml biopython parsing • 3.6k views
ADD COMMENT
6
Entering edit mode
12.8 years ago

Using the gzip module:

import gzip
from Bio.Blast import NCBIXML

blast_file = gzip.open('output.xml.gz', 'rb')
blast_records = NCBIXML.parse(blast_file)
ADD COMMENT
0
Entering edit mode

Excellent, thanks a lot. Solved a major problem!

ADD REPLY

Login before adding your answer.

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