Skip to content

Commit

Permalink
Merge 531ce6b into 3e9aa12
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo committed Jun 20, 2022
2 parents 3e9aa12 + 531ce6b commit 02817a8
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 16 deletions.
13 changes: 9 additions & 4 deletions HISTORY.rst
Expand Up @@ -24,8 +24,10 @@ End-User Summary
- Adjusting default frequency filters for "clinvar pathogenic" filter: remove all threshold (#464).
- Adding note about difference with upstream Clinvar (#464).
- Switching scoring to MutationTaster 85 interface, added back MT 85 link-out alongside MT 2021 link-out (#509).
- Made flag filter and flag form nomenclature consistent (#297)
- Fixed broken VariantValidator query (#523)
- Made flag filter and flag form nomenclature consistent (#297).
- Fixed broken VariantValidator query (#523).
- Fixed smallvariant flags filter query (#502).
- Added flags `segregates`, `doesnt_segregate` and `no_disease_association` to file export (#502).

Full Change List
================
Expand All @@ -45,8 +47,11 @@ Full Change List
- Adjusting default frequency filters for "clinvar pathogenic" filter: remove all threshold (#464).
- Adding note about difference with upstream Clinvar (#464).
- Switching scoring to MutationTaster 85 interface, added back MT 85 link-out alongside MT 2021 link-out (#509).
- Made flag filter and flag form nomenclature consistent (#297)
- Fixed broken VariantValidator query (#523)
- Made flag filter and flag form nomenclature consistent (#297).
- Fixed broken VariantValidator query (#523).
- Fixed smallvariant flags filter query (#502).
- Added flags `segregates`, `doesnt_segregate` and `no_disease_association` to file export (#502).
- Converted not cooperative tooltip to standard title on Filter & Display button (#508).

------
v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions svs/templates/svs/_filter_form.html
Expand Up @@ -102,8 +102,8 @@
</div>
<div class="col text-right p-0">
<div class="btn-group">
<button type="submit" id="submitFilter" name="submit" value="display" class="btn btn-primary" data-toggle="tooltip" aria-haspopup="true" aria-expanded="false" data-html="true"
title="Filter variants again with current settings, limited to <i><b>Miscellaneous / Result row limit</b></i> results and display in table below"
<button type="submit" id="submitFilter" name="submit" value="display" class="btn btn-primary"
title='Filter variants again with current settings, limited to "Miscellaneous / Result row limit" results and display in table below'
data-url='{{ submit_button_url }}'
data-url-reload='{{ load_data_url }}'
{% if object.num_svs == 0 or not variant_set_exists %}disabled{% endif %}>
Expand Down
3 changes: 3 additions & 0 deletions svs/tests/factories.py
Expand Up @@ -165,6 +165,9 @@ class Meta:
flag_candidate = False
flag_final_causative = False
flag_for_validation = False
flag_no_disease_association = False
flag_segregates = False
flag_doesnt_segregate = False

flag_molecular = "empty"
flag_visual = "empty"
Expand Down
8 changes: 7 additions & 1 deletion varfish/static/js/flags_comments.js
Expand Up @@ -96,7 +96,7 @@ function clickVariantBookmark() {
dataType: "json",
}).done(function(data) {
// successfully updated flags, update bookmark display
if (data["flag_bookmarked"] || data["flag_for_validation"] || data["flag_candidate"] || data["flag_final_causative"]) {
if (data["flag_bookmarked"] || data["flag_for_validation"] || data["flag_candidate"] || data["flag_final_causative"] || data["flag_no_disease_association"] || data["flag_segregates"] || data["flag_doesnt_segregate"]) {
icon_bookmark.attr("src", "/icons/fa-solid/bookmark.svg");
} else {
icon_bookmark.attr("src", "/icons/fa-regular/bookmark.svg");
Expand Down Expand Up @@ -635,6 +635,9 @@ function clickVariantAcmgRatingModal(event) {
flag_for_validation: false,
flag_candidate: false,
flag_final_causative: false,
flag_no_disease_association: false,
flag_segregates: false,
flag_doesnt_segregate: false,
flag_visual: "empty",
flag_validation: "empty",
flag_phenotype_match: "empty",
Expand Down Expand Up @@ -776,6 +779,9 @@ function clickVariantAcmgRating() {
flag_for_validation: false,
flag_candidate: false,
flag_final_causative: false,
flag_no_disease_association: false,
flag_segregates: false,
flag_doesnt_segregate: false,
flag_visual: "empty",
flag_validation: "empty",
flag_phenotype_match: "empty",
Expand Down
3 changes: 3 additions & 0 deletions variants/file_export.py
Expand Up @@ -130,6 +130,9 @@ def to_str(val):
("flag_candidate", "Flag: selected as candidate disease-causing", str),
("flag_final_causative", "Flag: selected as final causative variant", str),
("flag_for_validation", "Flag: selected for validation", str),
("flag_no_disease_association", "Flag: selected for no known disease association", str),
("flag_segregates", "Flag: selected as segregating variant", str),
("flag_doesnt_segregate", "Flag: selected as not segregating variant", str),
("flag_molecular", "Rating: variant is molecular", str),
("flag_visual", "Rating: visual inspection of alignment", str),
("flag_validation", "Rating: validation result", str),
Expand Down
19 changes: 15 additions & 4 deletions variants/queries.py
Expand Up @@ -1219,14 +1219,25 @@ class ExtendQueryPartsFlagsJoinAndFilter(ExtendQueryPartsFlagsJoin):
def extend_conditions(self, _query_parts):
"""Build WHERE clause for the query based on the ``SmallVariantFlags`` and ``SmallVariantComment``."""
terms = []
not_terms = [true()]
none_terms = [true()]
# Add terms for the simple, boolean-valued flags.
flag_names = ("bookmarked", "candidate", "final_causative", "for_validation")
flag_names = (
"bookmarked",
"candidate",
"final_causative",
"for_validation",
"segregates",
"doesnt_segregate",
"no_disease_association",
)
for flag in flag_names:
flag_name = "flag_%s" % flag
if self.kwargs.get(flag_name):
terms.append(column(flag_name))
if self.kwargs.get("flag_simple_empty"):
terms.append(and_(not_(column("flag_%s" % flag))))
if self.kwargs.get("flag_simple_empty"):
not_terms.append(not_(column(flag_name)))
none_terms.append(column(flag_name).is_(None))
# Add terms for the valued flags.
flag_names = ("visual", "validation", "molecular", "phenotype_match", "summary")
for flag in flag_names:
Expand All @@ -1237,7 +1248,7 @@ def extend_conditions(self, _query_parts):
terms.append(column(flag_name) == value)
if value == "empty":
terms.append(column(flag_name).is_(None))
return [or_(*terms)]
return [or_(*terms, and_(*not_terms), and_(*none_terms))]


class ExtendQueryPartsAcmgCriteriaJoin(ExtendQueryPartsBase):
Expand Down
4 changes: 2 additions & 2 deletions variants/templates/variants/_filter_form.html
Expand Up @@ -134,8 +134,8 @@
</button>
{% else %}
<div class="btn-group">
<button type="button" id="submitFilter" name="submit" value="display" class="btn btn-primary" data-toggle="tooltip" aria-haspopup="true" aria-expanded="false" data-html="true"
title="Filter variants again with current settings, limited to <i><b>Miscellaneous / Result row limit</b></i> results and display in table below"
<button type="button" id="submitFilter" name="submit" value="display" class="btn btn-primary"
title='Filter variants again with current settings, limited to "Miscellaneous / Result row limit" results and display in table below'
data-url='{{ submit_button_url }}'
data-url-reload='{{ load_data_url }}'
data-url-request-last-job='{{ request_previous_job_url }}'
Expand Down
6 changes: 6 additions & 0 deletions variants/tests/factories.py
Expand Up @@ -185,6 +185,9 @@ class FormDataFactory(FormDataFactoryBase):
flag_candidate: bool = True
flag_final_causative: bool = True
flag_for_validation: bool = True
flag_no_disease_association: bool = True
flag_segregates: bool = True
flag_doesnt_segregate: bool = True
flag_phenotype_match_empty: bool = True
flag_phenotype_match_negative: bool = True
flag_phenotype_match_positive: bool = True
Expand Down Expand Up @@ -946,6 +949,9 @@ class Meta:
flag_candidate = False
flag_final_causative = False
flag_for_validation = False
flag_no_disease_association = False
flag_segregates = False
flag_doesnt_segregate = False
flag_molecular = ""
flag_visual = ""
flag_validation = ""
Expand Down
6 changes: 3 additions & 3 deletions variants/tests/test_file_export.py
Expand Up @@ -66,7 +66,7 @@ def test_export_tsv(self):
def _test_tabular(self, arrs, has_trailing):
self.assertEquals(len(arrs), 4 + int(has_trailing))
# TODO: also test without flags and comments
self.assertEquals(len(arrs[0]), 46)
self.assertEquals(len(arrs[0]), 49)
self.assertSequenceEqual(arrs[0][:3], ["Chromosome", "Position", "Reference bases"])
self.assertSequenceEqual(
arrs[0][-5:],
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_export_tsv(self):
def _test_tabular(self, arrs, has_trailing):
self.assertEquals(len(arrs), 5 + int(has_trailing))
# TODO: also test without flags and comments
self.assertEquals(len(arrs[0]), 47)
self.assertEquals(len(arrs[0]), 50)
self.assertSequenceEqual(arrs[0][:3], ["Sample", "Chromosome", "Position"])
self.assertEqual(arrs[0][-1], "sample Alternate allele fraction")
members = sorted(self.project.get_members())
Expand Down Expand Up @@ -411,7 +411,7 @@ def test_export_tsv_as_contributor_for_cohort_by_superuser(self):
def _test_tabular(self, arrs, ref, has_trailing, smallvars):
self.assertEquals(len(arrs), ref + int(has_trailing))
# TODO: also test without flags and comments
self.assertEquals(len(arrs[0]), 47)
self.assertEquals(len(arrs[0]), 50)
self.assertSequenceEqual(arrs[0][:3], ["Sample", "Chromosome", "Position"])
self.assertEqual(arrs[0][-1], "sample Alternate allele fraction")
for i, small_var in enumerate(sorted(smallvars, key=lambda x: (x.chromosome_no, x.start))):
Expand Down

0 comments on commit 02817a8

Please sign in to comment.