def best_alignment_iterator(query_iterator):
    for alignments in query_iterator:
        scores = []
        for alignment in alignments:
            scores.append(alignment.score)
        best = max(scores)
        best_alignments = [x for x in alignments if x.score == best]
        if len(best_alignments) > 1:
            best_alignments = random.sample(best_alignments, 1)
        best_alignment = best_alignments[0]
        yield best_alignment
return stats for best alignment - best is determined
dataset/ETHPy150Open CGATOxford/cgat/CGAT/Diamond.py/best_alignment_iterator