[Biopython] NCBIXML module: missing sgi, qlen, slen, mismacth and others

Wibowo Arindrarto w.arindrarto at gmail.com
Thu Jun 13 19:36:36 UTC 2013


Hi Frederico,

This isn't exactly using NCBIXML (SearchIO instead;
http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc100), but
you can indeed access them:

from Bio import SearchIO

for query_result in SearchIO.parse('your_blast.xml', 'blast-xml'):
    print 'query length is', query_result.seq_len
    for hit in query_result:
        print 'sgi is', hit.id
        for hsp in hit:
            print 'mismatch is',
hsp.aln_annotation['homology'].count(' ')  # mismatch == no match at
all, so we count the gaps in the consensus sequence

All the other attributes are of course available as well:
- identities == hsp.ident_num
- score == hsp.bitscore_raw
- bits == hsp.bitscore
- expect == hsp.evalue

Hope that helps :),
Bow

On Thu, Jun 13, 2013 at 4:07 PM, Frederico Moraes Ferreira
<ferreirafm at usp.br> wrote:
> Biopythoneers,
> How do I get sgi, qlen, mismacth from a blastp xml record?
> I've got hsp.identities, hsp.score, hsp.bits, and hsp.expect, but also need
> those mentioned. Don't they were implemented?
> Thanks in advance.
> Best
>
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython



More information about the Biopython mailing list