How to parse NCBI Blast XML to retrieve "hsp_query-from in Biopython?
1
0
Entering edit mode
7.6 years ago
philipp ▴ 30

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 • 3.5k views
ADD COMMENT
1
Entering edit mode
7.6 years ago
Markus ▴ 320
  • 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 COMMENT

Login before adding your answer.

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