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 http://biopython.org/DIST/docs/api/Bio.SearchIO.BlastIO-pysrc.html 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 = blast_hit.id print "This is blast_hit.id ", query subject = blast_hit.sacc_ver print "This is blast_hit subject accession ", subject
As per http://biopython.org/DIST/docs/api/Bio.SearchIO.BlastIO-module.html, 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.