Entering edit mode
                    13.9 years ago
        Aziz
        
    
        ▴
    
    10
    hi , i'm using biopython to parse my blast xml output i make condition print on the number of for query. i print my query and sbject if the query have only one hit. but it's not working here is my script please help. thanks
result_handle = open("result.xml")
blast_records = NCBIXML.parse(result_handle)
 for blast_record in blast_records:
    for alignment in blast_record.alignments:
           for hsp in alignment.hsps:
              if(hsp.num_alignments == 1):
                   print "Query:",blast_record.query
                   print "subjet:",alignment.hit_def
                   print "length:", alignment.length
                   print "nombre de gaps:",hsp.gaps
Please indent lines of code with 4 or more spaces to make it readable.
And please elaborate: what are you trying to do, what is the result you want to get, and what do you get instead? In this form, it is not clear what you're asking at all.