diff options
author | Muriithi Frederick Muriuki | 2021-09-08 10:56:56 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2021-09-08 10:56:56 +0300 |
commit | a718069c757bea9f7ecbaee25e23bd581750f906 (patch) | |
tree | 0d04f09fa39bee446968a494f3713281aa264476 /gn3/computations | |
parent | 3f323734fcf258d28f3f7d33fdc1518ef9ec24a8 (diff) | |
download | genenetwork3-a718069c757bea9f7ecbaee25e23bd581750f906.tar.gz |
Ease search for traits and chromosomes
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi
* Return a dict of values rather than list for the traits and chromosomes to
ease searching through the data.
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/qtlreaper.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gn3/computations/qtlreaper.py b/gn3/computations/qtlreaper.py index 02d6572..5180853 100644 --- a/gn3/computations/qtlreaper.py +++ b/gn3/computations/qtlreaper.py @@ -110,12 +110,15 @@ def organise_reaper_main_results(parsed_results): unique_chromosomes = {item["Chr"] for item in id_items} return { "ID": identifier, - "chromosomes": [ + "chromosomes": {_chr["Chr"]: _chr for _chr in [ __organise_by_chromosome(chromo, id_items) - for chromo in sorted(unique_chromosomes)]} + for chromo in sorted( + unique_chromosomes, key=chromosome_sorter_key_fn)]}} unique_ids = {res["ID"] for res in parsed_results} - return [__organise_by_id(_id, parsed_results) for _id in sorted(unique_ids)] + return { + trait["ID"]: trait for trait in + [__organise_by_id(_id, parsed_results) for _id in sorted(unique_ids)]} def parse_reaper_main_results(results_file): """ |