gravatar for lwu8

7 hours ago by

Hi, could someone help me ?
I am trying to parse hmmer results from a file with the code in biopython, however when I run it, it shows no "hits"attribute in the line with 'hits = qresult.hits' :

import Bio
from Bio import SearchIO
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
with open ("file",'rU') as handle:
# read used for search output files with a single query
for qresult in SearchIO.read(handle, 'hmmer3-text'):
query_id = qresult.id # seqID from fasta
hits = qresult.hits
num_hits = len(hits) # how many items (hits) by using len()
if num_hits > 0: # if there are more than 0 hits in this query then extract the info
for i in range(0, num_hits):
hmm_name = hits[i].id # hit name
hmm_description = hits[i].description # hit decription
current_evalue = hits[i].evalue # evalue of hit
handle.close() # close file

link

written
7 hours ago
by

lwu80



Source link