diff --git a/HISTORY.rst b/HISTORY.rst index b6d955a29..c31d1d9f5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -41,6 +41,7 @@ End-User Summary Alternatively, you can use ``python manage.py svs_sv_fill_nulls`` to update the records on the fly. - Implement new in-house background database for structural variants (#32). - Allow to exclude cases from in-house database through project settings (#579). +- Adding distinct de novo genotype setting (#562). Full Change List ================ @@ -77,6 +78,7 @@ Full Change List - Bugfix broken SV filter (#587). - Implement new in-house background database for structural variants (#32). - Allow to exclude cases from in-house database through project settings (#579). +- Adding distinct de novo genotype setting (#562). ------ v1.2.0 diff --git a/varfish/static/js/filter_form.js b/varfish/static/js/filter_form.js index e366e63f8..7b1e0924d 100644 --- a/varfish/static/js/filter_form.js +++ b/varfish/static/js/filter_form.js @@ -501,8 +501,11 @@ const presets = { }, "inheritance-dominant": { "ids": {}, - // dom-denovo doesn't exist in the select. this triggers a function - "classes": {"genotype-field-gt": "dom-denovo"}, + "classes": {"genotype-field-gt": "dominant"}, + }, + "inheritance-de-novo": { + "ids": {}, + "classes": {"genotype-field-gt": "de-novo"}, }, "inheritance-hom-recessive": { "ids": {}, @@ -1469,7 +1472,21 @@ function enableHomRecessiveMode(target) { } -function enableDomDenovoMode() { +function enableDeNovoMode() { + // Index will be set to variant, all others to ref + $("[id^=id_][id$=_gt]").each( + function () { + console.log($(this), $(this).data("default-index")) + if ($(this).data("default-index") === 1) { + $(this).val("variant") + } else { + $(this).val("ref") + } + } + ) +} + +function enableDominantMode() { // All affected will be set to het $("[id^=id_][id$=_gt].affected").val("het"); // All unaffected will be set to ref @@ -1637,7 +1654,6 @@ function applyPresetsToSettings(presets, name) { ( val == "index" || val == "recessive-index" - || val == "dom-denovo" || val == "hom-recessive" || val == "mitochondrial" || val == "x-recessive" @@ -1645,10 +1661,6 @@ function applyPresetsToSettings(presets, name) { ) { continue; } - // Dominant denovo is not an option in the genotype select, so let a function do the change. - if (val == "dom-denovo") { - enableDomDenovoMode(); - } // Homozygous recessive is not an option in the genotype select, so let a function do the change. else if (val == "hom-recessive") { enableHomRecessiveMode(tag); @@ -1661,6 +1673,14 @@ function applyPresetsToSettings(presets, name) { else if (val == "x-recessive") { enableXRecessiveMode(tag); } + // X recessive is not an option in the genotype select, so let a function do the change. + else if (val == "de-novo") { + enableDeNovoMode(); + } + // X recessive is not an option in the genotype select, so let a function do the change. + else if (val == "dominant") { + enableDominantMode(); + } // Default change behaviour for all others else { tag.val(val); @@ -1698,7 +1718,7 @@ function updateQuickPresets(settings) { } const quickPresetCategories = ["inheritance", "frequency", "impact", "quality", "region", "flags"]; const quickPresetCandidates = { - "inheritance": ["any", "dominant", "hom-recessive", "comp-het", "recessive", "mitochondrial", "x-recessive"], + "inheritance": ["any", "dominant", "de-novo", "hom-recessive", "comp-het", "recessive", "mitochondrial", "x-recessive"], "frequency": ["super-strict", "strict", "relaxed", "recessive-strict", "recessive-relaxed", "all"], "impact": ["null-variant", "aa-change", "all-coding-deep-intronic", "whole-transcript", "any"], "quality": ["super-strict", "strict", "relaxed", "ignore"], @@ -1852,7 +1872,7 @@ function loadPresets(element) { $("#input-presets-region").val("region-whole-genome") $("#input-presets-flags").val("flags-default") } else if (presetsName == "de-novo") { - $("#input-presets-inheritance").val("inheritance-dominant") + $("#input-presets-inheritance").val("inheritance-de-novo") $("#input-presets-frequency").val("frequency-strict") $("#input-presets-impact").val("impact-aa-change") $("#input-presets-quality").val("quality-relaxed") diff --git a/variants/forms.py b/variants/forms.py index 24ab22822..5e5551b66 100644 --- a/variants/forms.py +++ b/variants/forms.py @@ -442,10 +442,7 @@ def clean(self): result["compound_recessive_indices"][family] = name elif result[self.get_genotype_field_names()[name]["gt"]] == "recessive-index": result["recessive_indices"][family] = name - elif result[self.get_genotype_field_names()[name]["gt"]] in ( - "hom-recessive-index", - "dom-denovo-index", - ): + elif result[self.get_genotype_field_names()[name]["gt"]] == "hom-recessive-index": self.add_error( self.get_genotype_field_names()[name]["gt"], "This option value shouldn't be passed. Selecting it should trigger JS code which changes the value.", diff --git a/variants/query_presets.py b/variants/query_presets.py index fd9960007..869ccdabc 100644 --- a/variants/query_presets.py +++ b/variants/query_presets.py @@ -77,6 +77,7 @@ class GenotypeChoice(Enum): class Inheritance(Enum): """Preset options for category inheritance""" + DE_NOVO = "de_novo" DOMINANT = "dominant" HOMOZYGOUS_RECESSIVE = "homozygous_recessive" COMPOUND_HETEROZYGOUS = "compound_heterozygous" @@ -204,6 +205,17 @@ def to_settings( for s in samples }, } + elif self == Inheritance.DE_NOVO: + return { + "recessive_index": None, + "recessive_mode": None, + "genotype": { + s.name: GenotypeChoice.VARIANT.value + if s.name == index_candidates[0].name + else GenotypeChoice.REF.value + for s in samples + }, + } elif self == Inheritance.DOMINANT: return { "recessive_index": None, @@ -998,7 +1010,7 @@ class _QuickPresetList: ) #: *de novo* presets de_novo: QuickPresets = QuickPresets( - inheritance=Inheritance.DOMINANT, + inheritance=Inheritance.DE_NOVO, frequency=Frequency.DOMINANT_STRICT, impact=Impact.AA_CHANGE_SPLICING, quality=Quality.RELAXED, diff --git a/variants/query_schemas.py b/variants/query_schemas.py index b608413bf..56ba181eb 100644 --- a/variants/query_schemas.py +++ b/variants/query_schemas.py @@ -243,7 +243,6 @@ class CaseQueryV1: recessive_mode: typing.Optional[RecessiveModeV1] = None recessive_index: typing.Optional[str] = None - denovo_index: typing.Optional[str] = None exac_frequency: typing.Optional[float] = None exac_heterozygous: typing.Optional[int] = None @@ -406,8 +405,6 @@ def convert(self, case: Case, query: CaseQueryV1) -> typing.Dict[str, typing.Any result["%s_gt" % sample] = "recessive-index" elif sample in result["compound_recessive_indices"].values(): result["%s_gt" % sample] = "index" - elif sample == query.denovo_index: - result["%s_gt" % sample] = "dom-denovo-index" else: gt = query.genotype.get(sample, GenotypeChoiceV1.ANY) if gt: diff --git a/variants/schemas/case-query-v1.json b/variants/schemas/case-query-v1.json index 25034b6dd..14ff364d0 100644 --- a/variants/schemas/case-query-v1.json +++ b/variants/schemas/case-query-v1.json @@ -1293,22 +1293,6 @@ } ] }, - "denovo_index": { - "anyOf": [ - { - "type": "null" - }, - { - "$id": "#/properties/denovo_index", - "type": "string", - "title": "Select the denovo index", - "description": "Set to the identifier of the de novo index", - "examples": [ - "CHILD-NAME" - ] - } - ] - }, "quality": { "$id": "#/properties/quality", "type": "object", diff --git a/variants/templates/variants/filter_form/presets.html b/variants/templates/variants/filter_form/presets.html index 24a2bc157..67d6e48cc 100644 --- a/variants/templates/variants/filter_form/presets.html +++ b/variants/templates/variants/filter_form/presets.html @@ -28,7 +28,8 @@