changeset 12:19ac771cf32a draft

Uploaded 20180414
author fabio
date Sat, 14 Apr 2018 07:33:58 -0400
parents 51e30a7f48c4
children 4646e524cd43
files ._.shed.yml ._query.py ._query.xml query.py
diffstat 4 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
Binary file ._.shed.yml has changed
Binary file ._query.py has changed
Binary file ._query.xml has changed
--- 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: