aboutsummaryrefslogtreecommitdiff
path: root/gn3/heatmaps.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-09-20 06:36:00 +0300
committerFrederick Muriuki Muriithi2021-09-20 06:36:00 +0300
commitb7fb10586b956a8b0389e7925e4c0cff28cde82f (patch)
tree42fd08f811e7fdc36a4b3c6decf0f649dd552211 /gn3/heatmaps.py
parent1e2357049adc72808fbf8eaac3da9411d3c78c66 (diff)
downloadgenenetwork3-b7fb10586b956a8b0389e7925e4c0cff28cde82f.tar.gz
Return only the data
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/api/heatmaps.py: Parse incoming data to build up correct trait names and respond with only the computed heatmap data. * gn3/heatmaps.py: Return only the computed data for heatmaps and clustering. Since GN3 is supposed to handle only the data, and db-access, this commit ensures that GN3 responds to the client with only the computed heatmap data, and does not try to generate the heatmaps themselves. The generation of the heatmaps will be delegated to the UI clients, such as GeneNetwork2.
Diffstat (limited to 'gn3/heatmaps.py')
-rw-r--r--gn3/heatmaps.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py
index c4fc67d..205a3b3 100644
--- a/gn3/heatmaps.py
+++ b/gn3/heatmaps.py
@@ -199,17 +199,26 @@ def build_heatmap(traits_names, conn: Any):
zip(traits_ids,
[traits[idx]["trait_fullname"] for idx in traits_order]))
- return generate_clustered_heatmap(
- process_traits_data_for_heatmap(
+ # return generate_clustered_heatmap(
+ # process_traits_data_for_heatmap(
+ # organised, traits_ids, chromosome_names),
+ # clustered,
+ # "single_heatmap_{}".format(random_string(10)),
+ # y_axis=tuple(
+ # ordered_traits_names[traits_ids[order]]
+ # for order in traits_order),
+ # y_label="Traits",
+ # x_axis=chromosome_names,
+ # x_label="Chromosomes")
+ return {
+ "clustering_data": clustered,
+ "heatmap_data": process_traits_data_for_heatmap(
organised, traits_ids, chromosome_names),
- clustered,
- "single_heatmap_{}".format(random_string(10)),
- y_axis=tuple(
+ "traits": tuple(
ordered_traits_names[traits_ids[order]]
for order in traits_order),
- y_label="Traits",
- x_axis=chromosome_names,
- x_label="Chromosomes")
+ "chromosomes": chromosome_names
+ }
def compute_traits_order(slink_data, neworder: tuple = tuple()):
"""