Question: AttributeError: 'Hit' object has no attribute 'sacc_ver'
gravatar for bioinfoSeeker
22 months ago by
United Kingdom
bioinfoSeeker20 wrote:

Hi, I am trying to write a script to parse and summarize the ncbi web blast output (14 columns). I am using biopython searchIO on the tab delimited output file with the first seven lines commented by default.

I get the following error : AttributeError: 'Hit' object has no attribute 'sacc_ver'

In my previous post, I had described how I had to use the fields from searchIO documentation to replace the corresponding fields from the blast report, in the script. A: Blast parse script: ValueError: Required query and/or hit ID field not found.

from Bio import SeqIO
from Bio import SearchIO

file = "out.txt"
custom_fields = 'qseqid sseqid qaccver sacc_ver nident length mismatch gapopen qstart qend sstart send evalue score'

blast_generator = SearchIO.parse(file, 'blast-tab', fields=custom_fields, comments=True)
for blast_qresult in blast_generator:
    print "This is blast_qresult ", blast_qresult
    for k,blast_hit in enumerate(blast_qresult):
        print "This is blast_qresult.hit ", blast_hit
        query =
        print "This is ", query
        subject = blast_hit.sacc_ver
        print "This is blast_hit subject accession ", subject

As per, the sacc_ver attribute is present in the blast_hit object. So, I am not sure why it gives this error. Can you please help me to identify my error.

blast biopython searchio python • 813 views
ADD COMMENTlink modified 22 months ago • written 22 months ago by bioinfoSeeker20

What version of Biopython do you have? If updating does not fix this you might want to report this at

ADD REPLYlink written 22 months ago by Peter5.8k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1605 users visited in the last hour