From 91c2f1c8a2b72b376b01a2adfd4fbef83191e187 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 11 Dec 2024 12:16:39 +1030 Subject: [PATCH] issue #1159 - cohort per sample zygosity warnings, and return empty if none selected --- .../node_editors/cohort_zygosity_filters.html | 70 ++++++++++++++++--- snpdb/models/models_cohort.py | 4 ++ 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/analysis/templates/analysis/node_editors/cohort_zygosity_filters.html b/analysis/templates/analysis/node_editors/cohort_zygosity_filters.html index 48e8a6f39..bc4b20689 100644 --- a/analysis/templates/analysis/node_editors/cohort_zygosity_filters.html +++ b/analysis/templates/analysis/node_editors/cohort_zygosity_filters.html @@ -16,16 +16,54 @@ @@ -89,3 +129,17 @@ + + diff --git a/snpdb/models/models_cohort.py b/snpdb/models/models_cohort.py index 39e33ad6d..7bc0be4c7 100644 --- a/snpdb/models/models_cohort.py +++ b/snpdb/models/models_cohort.py @@ -483,6 +483,10 @@ def get_zygosity_q(self, sample_zygosities: dict, sample_require_zygosity: dict sample_require_zygosity = {sample : True/False} - defaults to True exclude - invert query (not equals) """ + if all([not v for v in sample_zygosities.values()]): + # nothing selected + q_none = Q(pk__isnull=True) + return q_none if sample_require_zygosity is None: sample_require_zygosity = {}