Skip to content

Commit

Permalink
Removing display_hgmd_public_membership (varfish-org#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Feb 25, 2022
1 parent 2898ef0 commit 00bfc89
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 37 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -98,6 +98,7 @@ Full Change List
- DgvSvs and DgvGoldStandardSvs are two different data sources now
- Adding deep linking into case details tab (#344)
- Allowing direct update of variant annotations and ACMG ratings on case annotations details (#344)
- Removing `display_hgmd_public_membership` (#363)

-------
v0.23.9
Expand Down
1 change: 0 additions & 1 deletion variants/forms.py
Expand Up @@ -1098,7 +1098,6 @@ def __init__(self, *args, **kwargs):
def clean(self):
"""Translate effect field names into ``effects`` key list"""
cleaned_data = super().clean()
cleaned_data["display_hgmd_public_membership"] = True
return cleaned_data


Expand Down
11 changes: 0 additions & 11 deletions variants/queries.py
Expand Up @@ -447,29 +447,18 @@ def __init__(self, *args, **kwargs):
.lateral("hgmd_subquery")
)

def _get_skip_query(self):
return not self.kwargs.get("require_in_hgmd_public") and not self.kwargs.get(
"display_hgmd_public_membership"
)

def extend_fields(self, _query_parts):
if self._get_skip_query():
return []
return [
func.coalesce(self.subquery.c.hgmd_public_overlap, 0).label("hgmd_public_overlap"),
func.coalesce(self.subquery.c.hgmd_accession, "").label("hgmd_accession"),
]

def extend_selectable(self, query_parts):
if self._get_skip_query():
return query_parts.selectable
return query_parts.selectable.outerjoin(self.subquery, true())


class ExtendQueryPartsHgmdJoinAndFilter(ExtendQueryPartsHgmdJoin):
def extend_conditions(self, _query_parts):
if self._get_skip_query():
return []
if self.kwargs["require_in_hgmd_public"]:
return [column("hgmd_public_overlap") > 0]
return []
Expand Down
1 change: 0 additions & 1 deletion variants/tests/factories.py
Expand Up @@ -81,7 +81,6 @@ class FormDataFactoryBase:
transcripts_noncoding: bool = True
remove_if_in_dbsnp: bool = False
require_in_hgmd_public: bool = False
display_hgmd_public_membership: bool = False
require_in_clinvar: bool = False
clinvar_include_benign: bool = False
clinvar_include_likely_benign: bool = False
Expand Down
26 changes: 2 additions & 24 deletions variants/tests/test_queries.py
Expand Up @@ -4408,34 +4408,12 @@ def setUp(self):
end=self.small_vars[1].start,
)

def test_no_hgmd_query(self):
self.run_query(
CasePrefetchQuery,
{"require_in_hgmd_public": False, "display_hgmd_public_membership": False},
2,
)

def test_require_in_hgmd_query(self):
self.run_query(
CasePrefetchQuery,
{"require_in_hgmd_public": True, "display_hgmd_public_membership": False},
1,
)

def test_display_hgmd_membership_query(self):
res = self.run_query(
CasePrefetchQuery,
{"require_in_hgmd_public": False, "display_hgmd_public_membership": True},
2,
)
res = self.run_query(CasePrefetchQuery, {"require_in_hgmd_public": False}, 2,)
self.assertEqual(res[1].hgmd_accession, self.hgmd.variation_name)

def test_require_in_hgmd_and_display_membership_query(self):
res = self.run_query(
CasePrefetchQuery,
{"require_in_hgmd_public": True, "display_hgmd_public_membership": True},
1,
)
res = self.run_query(CasePrefetchQuery, {"require_in_hgmd_public": True}, 1,)
self.assertEqual(res[0].hgmd_accession, self.hgmd.variation_name)


Expand Down

0 comments on commit 00bfc89

Please sign in to comment.