about summary refs log tree commit diff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-09-15 11:41:36 +0300
committerFrederick Muriuki Muriithi2021-09-15 11:41:36 +0300
commitb1eb0451578c53afabe4f2054ce08665dec4bb82 (patch)
treeff8fcbdfdc37ae9993a127f3896d3c769da0b6d3 /gn3
parente3e18950cfcdec918429dcbb5d5ed2e9616b7a20 (diff)
downloadgenenetwork3-b1eb0451578c53afabe4f2054ce08665dec4bb82.tar.gz
Integrate get_lsr_from_chr function
* gn3/heatmaps.py: copy over function
* tests/unit/test_heatmaps.py: add tests

  Copy function over from proof of concept and add some tests to ensure it
  works as expected.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/heatmaps.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py
index 198fb45..991ddec 100644
--- a/gn3/heatmaps.py
+++ b/gn3/heatmaps.py
@@ -276,6 +276,14 @@ def get_nearest_marker(traits_list, genotype):
     marker_finder = nearest_marker_finder(genotype)
     return [marker_finder(trait) for trait in traits_list]
 
+def get_lrs_from_chr(trait, chr_name):
+    chromosome = trait["chromosomes"].get(chr_name)
+    if chromosome:
+        return [
+            locus["LRS"] for locus in
+            sorted(chromosome["loci"], key=lambda loc: loc["Locus"])]
+    return [None]
+
 # # Grey + Blue + Red
 # def generate_heatmap():
 #     cols = 20