Question: Can Biopython Parse Gzipped Xml From Blast?
1
gravatar for Karthik
7.4 years ago by
Karthik20
India
Karthik20 wrote:

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!

xml biopython blast parsing • 2.3k views
ADD COMMENTlink modified 5.2 years ago by Biostar ♦♦ 20 • written 7.4 years ago by Karthik20
6
gravatar for Jeroen Van Goey
7.4 years ago by
Jeroen Van Goey2.2k
Ghent, Belgium
Jeroen Van Goey2.2k wrote:

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 COMMENTlink written 7.4 years ago by Jeroen Van Goey2.2k

Excellent, thanks a lot. Solved a major problem!

ADD REPLYlink written 7.4 years ago by Karthik20
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: 1555 users visited in the last hour