aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/heatmap.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-08-31 11:16:29 +0300
committerMuriithi Frederick Muriuki2021-08-31 11:16:29 +0300
commitb5e1d1176f1bf4f7c0b68b27beb15e99418f1650 (patch)
treef158a54b262214ca65394a7dc65a64590533cc0c /gn3/computations/heatmap.py
parente441509a59c20a051fd5ab94710513f1968a5e02 (diff)
downloadgenenetwork3-b5e1d1176f1bf4f7c0b68b27beb15e99418f1650.tar.gz
Fix linting errors, minor bugs and reorganise code
* Fix some linting errors and some minor bugs caught by the linter. Move the `random_string` function to separate module for use in multiple places in the code.
Diffstat (limited to 'gn3/computations/heatmap.py')
-rw-r--r--gn3/computations/heatmap.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/gn3/computations/heatmap.py b/gn3/computations/heatmap.py
index 92014cf..1143450 100644
--- a/gn3/computations/heatmap.py
+++ b/gn3/computations/heatmap.py
@@ -6,6 +6,7 @@ generate various kinds of heatmaps.
from functools import reduce
from typing import Any, Dict, Sequence
from gn3.computations.slink import slink
+from gn3.computations.qtlreaper import generate_traits_file
from gn3.computations.correlations2 import compute_correlation
from gn3.db.genotypes import build_genotype_file, load_genotype_samples
from gn3.db.traits import (
@@ -155,14 +156,14 @@ def heatmap_data(traits_names, conn: Any):
for fullname in traits_names]
traits_list = tuple(x[0] for x in traits_details)
traits_data_list = [x[1] for x in traits_details]
- exported_traits_data_list = tuple(
- export_trait_data(td, strainlist) for td in traits_data_list)
genotype_filename = build_genotype_file(traits_list[0]["riset"])
strainlist = load_genotype_samples(genotype_filename)
+ exported_traits_data_list = tuple(
+ export_trait_data(td, strainlist) for td in traits_data_list)
slink_data = slink(cluster_traits(exported_traits_data_list))
ordering_data = compute_heatmap_order(slink_data)
strains_and_values = retrieve_strains_and_values(
- orders, strainlist, exported_traits_data_list)
+ ordering_data, strainlist, exported_traits_data_list)
strains_values = strains_and_values[0][1]
trait_values = [t[2] for t in strains_and_values]
traits_filename = generate_traits_filename()