This is a test version of Biostars. For the public version, visit https://www.biostars.org.
where is "% Identity" column in blast-xml

I am trying to parse blast-xml file from blastp search using searchIO in Biopython. However, I am not sure which one I should use for extracting % identity.

In blast-tab file, I can use hsp.pident, does anyone know the equivalent attribute name for blast-xml. Or I should derive myself, hsp.ident_num/hsp.aln_span*100. Thanks

searchio biopython blast

1 answer

The BLAST XML output format does not contain the percentage identify as an explicit field, so yes, you must calculate it from the number of identities and the alignment length.

See for example my BLAST XML to tabular conversion script: https://github.com/peterjc/galaxy_blast/blob/master/tools/ncbi_blast_plus/blastxml_to_tabular.py#L230

(Note if you are using Python 2, beware of integer division if you do the calculation as currently written!)

Log in to answer this question.