aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-09-08 10:56:56 +0300
committerMuriithi Frederick Muriuki2021-09-08 10:56:56 +0300
commita718069c757bea9f7ecbaee25e23bd581750f906 (patch)
tree0d04f09fa39bee446968a494f3713281aa264476 /gn3
parent3f323734fcf258d28f3f7d33fdc1518ef9ec24a8 (diff)
downloadgenenetwork3-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')
-rw-r--r--gn3/computations/qtlreaper.py9
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):
"""