def numBlast_sort(blast, numHits, evalueT, bitT):
header = ['<STR_LIT>', '<STR_LIT:target>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>yield header<EOL>hmm = {h:[] for h in header}<EOL>for line in blast:<EOL><INDENT>if line.startswith('<STR_LIT:#>'):<EOL><INDENT>continue<EOL><DEDENT>line = line.strip().split('<STR_LIT:\t>')<EOL>line[<NUM_LIT:10>], line[<NUM_LIT:11>] = float(line[<NUM_LIT:10>]), float(line[<NUM_LIT:11>])<EOL>evalue, bit = line[<NUM_LIT:10>], line[<NUM_LIT:11>]<EOL>if evalueT is not False and evalue > evalueT:<EOL><INDENT>continue<EOL><DEDENT>if bitT is not False and bit < bitT:<EOL><INDENT>continue<EOL><DEDENT>for i, h in zip(line, header):<EOL><INDENT>hmm[h].append(i)<EOL><DEDENT><DEDENT>hmm = pd.DataFrame(hmm)<EOL>for query, df in hmm.groupby(by = ['<STR_LIT>']):<EOL><INDENT>df = df.sort_values(by = ['<STR_LIT>'], ascending = False)<EOL>for hit in df[header].values[<NUM_LIT:0>:numHits]:<EOL><INDENT>yield hit<EOL><DEDENT><DEDENT>
parse b6 output with sorting