Question: How to parse NCBI Blast XML to retrieve "hsp_query-from in Biopython?
0
gravatar for philipp
3.4 years ago by
philipp10
philipp10 wrote:

Hey,

I have a question concerning parsng NCBI BLAST XML outputs. I can parse the hsp score of the BLAST results. Unfortunately, I face difficulties parsing other entries in the XML.

I need to parse hsp_query-from, hsp_query-to, hsp_align-len, and hsp_identity.

This code works:

    for record in NCBIXML.parse(result_handle):
    for alignment in record.alignments:
        for hsp in alignment.hsps:
            hsp_score = hsp.score

How can I get the other entries? Especially hsp_query-from seems to be tricky because "from" is reserved by python.

I appreciate your help a lot!

Best, Philipp

biopython parse xml • 1.7k views
ADD COMMENTlink modified 3.4 years ago by Markus270 • written 3.4 years ago by philipp10
1
gravatar for Markus
3.4 years ago by
Markus270
Markus270 wrote:
  • hsp_query-from: hsp.query_start
  • hsp_query-to: hsp.query_end
  • hsp_align-len: hsp.align_length
  • hsp_identity: hsp.identities

You can lookup the keywords in the source code of the NCBIXML parser at http://biopython.org/DIST/docs/api/Bio.Blast.NCBIXML-pysrc.html to find the respective parameters.

ADD COMMENTlink written 3.4 years ago by Markus270
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: 654 users visited in the last hour