Skip to content

Commit

Permalink
#1159 - CohortNode - wrong counts after selecting individual samples
Browse files Browse the repository at this point in the history
  • Loading branch information
davmlaw committed Dec 10, 2024
1 parent 056e3d5 commit ed7bb94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion analysis/models/nodes/analysis_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def get_help_text() -> str:
@staticmethod
def get_node_class_label():
""" Used in create node dropdown """
raise NotImplementedError()
raise NotImplementedError(f"get_node_class_label not implemented - this is probably due to a new class, or a reverse migration wiping out the subclass leaving just the AnalysisNode")

def _get_genome_build_errors(self, field_name, field_genome_build: GenomeBuild) -> list:
""" Used to quickly add errors about genome build mismatches
Expand Down
8 changes: 7 additions & 1 deletion analysis/models/nodes/node_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@ def get_rendering_dict(node):
else:
node_id = None

try:
node_class_label = node.get_node_class_label()
# This has happened a few times, help debug problem
except NotImplementedError as e:
raise NotImplementedError(f"Node {node_id=}: {e}")

style = f"left: {node.x}px; top: {node.y}px"
attributes = {
"node_id": node_id,
"node_class": node.get_node_class_label(),
"node_class": node_class_label,
"version_id": node.version,
"appearance_version_id": node.appearance_version,
"id": node.get_css_id(),
Expand Down
3 changes: 2 additions & 1 deletion snpdb/models/models_cohort.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ def get_zygosity_q(self, sample_zygosities: dict, sample_require_zygosity: dict
# If regex string is all "." (ie everything) then can optimise away
non_wildcard = regex_string.replace(".", "")
if not non_wildcard:
q = Q(pk__isnull=False)
# Show everything in cohort
q = Q(**{f"{self.cohortgenotype_alias}__isnull": False})
else:
q = Q(**{f"{self.cohortgenotype_alias}__samples_zygosity__regex": regex_string})
return q
Expand Down

0 comments on commit ed7bb94

Please sign in to comment.