Mercurial > repos > fabio > btman
diff query.py @ 12:19ac771cf32a draft
Uploaded 20180414
author | fabio |
---|---|
date | Sat, 14 Apr 2018 07:33:58 -0400 |
parents | 1af09c5ec0a1 |
children | 9ec4acef30ed |
line wrap: on
line diff
--- a/query.py Fri Apr 13 07:51:35 2018 -0400 +++ b/query.py Sat Apr 14 07:33:58 2018 -0400 @@ -88,14 +88,23 @@ if type(hit) is dict: # sabutan #accessions_list = accessions_list + str(hit['accession_number']) + "\t" + str(hit['score']) + "\n"; accession_number = hit['accession_number']; + #------------ + #score = hit['score']; + #score_split = score.split("/"); + #accessions_dict[accession_number] = "{0:.6f}".format(float(score_split[0])/float(score_split[1])); + #------------ + fraction = hit['fraction']; score = hit['score']; - score_split = score.split("/"); - accessions_dict[accession_number] = "{0:.6f}".format(float(score_split[0])/float(score_split[1])); + accession_scores = { + "fraction": str(fraction), + "score": float(score) + } + accessions_dict[accession_number] = accession_scores; is_sabutan = True; else: # all-some accessions_list = accessions_list + str(hit) + "\n"; if is_sabutan: - sorted_accessions = sorted(accessions_dict, key=lambda i: float(accessions_dict[i])); + sorted_accessions = sorted(accessions_dict, key=lambda i: float(accessions_dict[i]["score"]), reverse=True); for acc in sorted_accessions: accessions_list = accessions_list + str(acc) + "\t" + str(accessions_dict[acc]) + "\n"; with open(output_file_path, 'w') as out: