From f6c6f4dece0f3603ff049165e2609428e7d9f391 Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 5 Nov 2024 14:01:46 +0100 Subject: [PATCH 1/9] Simplify ClinSig query --- scout/adapter/mongo/query.py | 41 +++++++++++------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/scout/adapter/mongo/query.py b/scout/adapter/mongo/query.py index 4f8106e376..8329659d2b 100644 --- a/scout/adapter/mongo/query.py +++ b/scout/adapter/mongo/query.py @@ -329,7 +329,7 @@ def build_query( secondary_terms = True if primary_terms is True: - clinsign_filter = self.clinsig_query(query, mongo_query) + clinsign_filter = self.clinsig_query(query) # Secondary, excluding filter criteria will hide variants in general, # but can be overridden by an including, major filter criteria @@ -404,22 +404,12 @@ def affected_inds_query(self, mongo_query, case_id, gt_query): ]: # Consider situation where all individuals are unaffected mongo_query["samples"] = affected_query - def clinsig_query(self, query, mongo_query): - """Add clinsig filter values to the mongo query object - - Args: - query(dict): a dictionary of query filters specified by the users - mongo_query(dict): the query that is going to be submitted to the database - - Returns: - clinsig_query(dict): a dictionary with clinsig key-values - - """ + def clinsig_query(self, query: dict): + """Add clinsig filter values to the mongo query object""" LOG.debug("clinsig is a query parameter") trusted_revision_level = TRUSTED_REVSTAT_LEVEL rank = [] str_rank = [] - clnsig_query = {} for item in query["clinsig"]: rank.append(int(item)) @@ -427,6 +417,13 @@ def clinsig_query(self, query, mongo_query): rank.append(CLINSIG_MAP[int(item)]) str_rank.append(CLINSIG_MAP[int(item)]) + elem_match_or = { + "$or": [ + {"value": {"$in": rank}}, + {"value": re.compile("|".join(str_rank))}, + ] + } + if query.get("clinsig_confident_always_returned") is True: LOG.debug("add CLINSIG filter with trusted_revision_level") @@ -434,12 +431,7 @@ def clinsig_query(self, query, mongo_query): "clnsig": { "$elemMatch": { "$and": [ - { - "$or": [ - {"value": {"$in": rank}}, - {"value": re.compile("|".join(str_rank))}, - ] - }, + elem_match_or, {"revstat": re.compile("|".join(trusted_revision_level))}, ] } @@ -448,16 +440,7 @@ def clinsig_query(self, query, mongo_query): else: LOG.debug("add CLINSIG filter for rank: %s" % ", ".join(str(query["clinsig"]))) - clnsig_query = { - "clnsig": { - "$elemMatch": { - "$or": [ - {"value": {"$in": rank}}, - {"value": re.compile("|".join(str_rank))}, - ] - } - } - } + clnsig_query = {"clnsig": {"$elemMatch": elem_match_or}} return clnsig_query def coordinate_filter(self, query, mongo_query): From 3bba940190c01046c94767381f4bfc6a16bbc6df Mon Sep 17 00:00:00 2001 From: Daniel Nilsson Date: Tue, 5 Nov 2024 09:23:13 +0100 Subject: [PATCH 2/9] Triallelic cancer VAF (#4994) * Prioritise caller AF if available * Fix #2920 - prioritise FORMAT.AF for VAF if available --- CHANGELOG.md | 1 + scout/parse/variant/genotype.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9c8f86d13..9e9b559923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Update IGV.js to v3.0.9 - Managed variants VCF export more verbose on SVs - `/api/v1/hpo-terms` returns pymongo OperationFailure errors when provided query string contains problematic characters +- Prioritise caller AF if present ### Fixed - Empty custom_images dicts in case load config do not crash - Tracks missing alignment files are now properly skipped on generating IGV views diff --git a/scout/parse/variant/genotype.py b/scout/parse/variant/genotype.py index 546d800a1a..52a6a4df59 100755 --- a/scout/parse/variant/genotype.py +++ b/scout/parse/variant/genotype.py @@ -291,11 +291,12 @@ def get_split_reads(variant, pos): def get_alt_frequency(variant, pos): - """ """ - alt_frequency = float(variant.gt_alt_freqs[pos]) - if alt_frequency == -1: - if "AF" in variant.FORMAT: - alt_frequency = float(variant.format("AF")[pos][0]) + """AF - prioritise caller AF if set in FORMAT (e.g. DeepVariant does an INFO field)""" + if "AF" in variant.FORMAT: + alt_frequency = float(variant.format("AF")[pos][0]) + else: + alt_frequency = float(variant.gt_alt_freqs[pos]) + return alt_frequency From 758957efdf4c7ff28014e1ab7d91b23eca83f5a5 Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 5 Nov 2024 15:24:11 +0100 Subject: [PATCH 3/9] Fix ClinVar form to accept MedGen phenotypes (#4998) * Fix ClinVar form to accept MedGen phenotypes * typo --------- Co-authored-by: Chiara Rasi --- CHANGELOG.md | 1 + .../clinvar/templates/clinvar/multistep_add_variant.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9b559923..8afd208305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) ### Fixed - Empty custom_images dicts in case load config do not crash - Tracks missing alignment files are now properly skipped on generating IGV views +- ClinVar form to accept MedGen phenotypes ## [4.90.1] ### Fixed diff --git a/scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html b/scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html index bd5dbef919..a0f7d90705 100644 --- a/scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html +++ b/scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html @@ -390,10 +390,10 @@

Information provided by filling in these fields will be return false; } - // Make sure that provided conditions are numbers, except when condition type is MeSH + // Make sure that provided conditions are numbers, except when condition type is MeSH or MedGen var selectedConditionsValues = $('#condition_tags').val(); for (let i = 0; i < selectedConditionsValues.length; i++) { - if (isNaN(selectedConditionsValues[i]) && $('#condition_type').val() != 'MeSH'){ + if (isNaN(selectedConditionsValues[i]) && !['Mesh', 'MedGen'].includes($('#condition_type').val())){ alert(`Condition ID "${selectedConditionsValues[i]}" has an invalid format.`); return false; } From 348dcea1443ea21e9ad87e8f0e6aa5b932526670 Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Tue, 5 Nov 2024 15:39:22 +0100 Subject: [PATCH 4/9] Expand ClinVar submission description section to display full info (#5000) Co-authored-by: Chiara Rasi --- CHANGELOG.md | 1 + .../clinvar/templates/clinvar/clinvar_submissions.html | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8afd208305..a67487b92d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Managed variants VCF export more verbose on SVs - `/api/v1/hpo-terms` returns pymongo OperationFailure errors when provided query string contains problematic characters - Prioritise caller AF if present +- Expand the submissions information section on the ClinVar submissions page to fully display long text entries ### Fixed - Empty custom_images dicts in case load config do not crash - Tracks missing alignment files are now properly skipped on generating IGV views diff --git a/scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html b/scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html index 97165c0d63..483aaf0ab7 100644 --- a/scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html +++ b/scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html @@ -156,7 +156,7 @@

Variant data:

{{subm_obj.cases[subm_variant.case_id]}} {{subm_variant.ref_seq or '-'}} {{subm_variant.gene_symbol or '-'}} - {{subm_variant.hgvs|truncate(25,true,'..') or '-'}} + {{subm_variant.hgvs|truncate(100,true,'..') or '-'}} {{subm_variant.clinsig}} {{subm_variant.added_by or "N/A"}}
@@ -170,7 +170,7 @@

Variant data:

    {% for key, value in variant_header_fields.items() %} {% if subm_variant[key]%} -
  • {{ value }}: {{ subm_variant[key]|replace(subm_variant[key][75:], '..') if subm_variant[key]|length > 75 else subm_variant[key]}}
  • +
  • {{ value }}: {{ subm_variant[key]}}
  • {% endif %} {% endfor %}
@@ -214,7 +214,7 @@

Observation data:

{{subm_obj.cases[case.case_id]}} - {{var_key_name[case.linking_id]|truncate(25,true,'..')}} + {{var_key_name[case.linking_id]|truncate(100,true,'..')}} {{case.allele_origin}}
From 732ba528d3dec2bfcaa971f9698ba7cea5e128ad Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Wed, 6 Nov 2024 11:29:52 +0100 Subject: [PATCH 5/9] Fix variants clinsig triple filter --- CHANGELOG.md | 1 + scout/adapter/mongo/query.py | 20 ++++++++++++-------- scout/constants/query_terms.py | 1 - 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a67487b92d..9feda6c9f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Empty custom_images dicts in case load config do not crash - Tracks missing alignment files are now properly skipped on generating IGV views - ClinVar form to accept MedGen phenotypes +- Filtering variants by ClinVar significance, CLINSIG Confident and ClinVar hits at the same time ## [4.90.1] ### Fixed diff --git a/scout/adapter/mongo/query.py b/scout/adapter/mongo/query.py index 8329659d2b..124330bdcf 100644 --- a/scout/adapter/mongo/query.py +++ b/scout/adapter/mongo/query.py @@ -334,6 +334,13 @@ def build_query( # Secondary, excluding filter criteria will hide variants in general, # but can be overridden by an including, major filter criteria # such as a Pathogenic ClinSig. + + """ + if criterion == "clinvar_tag": + mongo_secondary_query.append({"clnsig": {"$exists": True}}) + mongo_secondary_query.append({"clnsig": {"$ne": None}}) + """ + if secondary_terms is True: secondary_filter = self.secondary_query(query, mongo_query) # If there are no primary criteria given, all secondary criteria are added as a @@ -425,8 +432,6 @@ def clinsig_query(self, query: dict): } if query.get("clinsig_confident_always_returned") is True: - LOG.debug("add CLINSIG filter with trusted_revision_level") - clnsig_query = { "clnsig": { "$elemMatch": { @@ -438,9 +443,12 @@ def clinsig_query(self, query: dict): } } else: - LOG.debug("add CLINSIG filter for rank: %s" % ", ".join(str(query["clinsig"]))) - clnsig_query = {"clnsig": {"$elemMatch": elem_match_or}} + + if query.get("clinvar_tag"): + clnsig_query["clnsig"]["$exists"] = True + clnsig_query["clnsig"]["$ne"] = None + return clnsig_query def coordinate_filter(self, query, mongo_query): @@ -760,10 +768,6 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): if criterion == "mvl_tag": mongo_secondary_query.append({"mvl_tag": {"$exists": True}}) - if criterion == "clinvar_tag": - mongo_secondary_query.append({"clnsig": {"$exists": True}}) - mongo_secondary_query.append({"clnsig": {"$ne": None}}) - if criterion == "cosmic_tag": mongo_secondary_query.append({"cosmic_ids": {"$exists": True}}) mongo_secondary_query.append({"cosmic_ids": {"$ne": None}}) diff --git a/scout/constants/query_terms.py b/scout/constants/query_terms.py index 61ef421210..5ef0dbd917 100644 --- a/scout/constants/query_terms.py +++ b/scout/constants/query_terms.py @@ -53,7 +53,6 @@ "somatic_score", "control_frequency", "mvl_tag", - "clinvar_tag", "cosmic_tag", "tumor_frequency", "fusion_score", From e5153dddb4d6f7cb123b0cf2d511f4341e4a723b Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Wed, 6 Nov 2024 11:33:08 +0100 Subject: [PATCH 6/9] Revert some wird changes --- CHANGELOG.md | 1 - scout/parse/variant/genotype.py | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9feda6c9f4..32ee72ed2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Update IGV.js to v3.0.9 - Managed variants VCF export more verbose on SVs - `/api/v1/hpo-terms` returns pymongo OperationFailure errors when provided query string contains problematic characters -- Prioritise caller AF if present - Expand the submissions information section on the ClinVar submissions page to fully display long text entries ### Fixed - Empty custom_images dicts in case load config do not crash diff --git a/scout/parse/variant/genotype.py b/scout/parse/variant/genotype.py index 52a6a4df59..546d800a1a 100755 --- a/scout/parse/variant/genotype.py +++ b/scout/parse/variant/genotype.py @@ -291,12 +291,11 @@ def get_split_reads(variant, pos): def get_alt_frequency(variant, pos): - """AF - prioritise caller AF if set in FORMAT (e.g. DeepVariant does an INFO field)""" - if "AF" in variant.FORMAT: - alt_frequency = float(variant.format("AF")[pos][0]) - else: - alt_frequency = float(variant.gt_alt_freqs[pos]) - + """ """ + alt_frequency = float(variant.gt_alt_freqs[pos]) + if alt_frequency == -1: + if "AF" in variant.FORMAT: + alt_frequency = float(variant.format("AF")[pos][0]) return alt_frequency From 3226e3e425737de5c4114763b499101c016d6a7e Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Wed, 6 Nov 2024 11:50:44 +0100 Subject: [PATCH 7/9] Thanks SonarCloud --- scout/adapter/mongo/query.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/scout/adapter/mongo/query.py b/scout/adapter/mongo/query.py index 124330bdcf..d1533207f0 100644 --- a/scout/adapter/mongo/query.py +++ b/scout/adapter/mongo/query.py @@ -13,7 +13,7 @@ ) CRITERION_EXCLUDE_OPERATOR = {False: "$in", True: "$nin"} - +EXISTS = "$exists" LOG = logging.getLogger(__name__) @@ -335,12 +335,6 @@ def build_query( # but can be overridden by an including, major filter criteria # such as a Pathogenic ClinSig. - """ - if criterion == "clinvar_tag": - mongo_secondary_query.append({"clnsig": {"$exists": True}}) - mongo_secondary_query.append({"clnsig": {"$ne": None}}) - """ - if secondary_terms is True: secondary_filter = self.secondary_query(query, mongo_query) # If there are no primary criteria given, all secondary criteria are added as a @@ -446,7 +440,7 @@ def clinsig_query(self, query: dict): clnsig_query = {"clnsig": {"$elemMatch": elem_match_or}} if query.get("clinvar_tag"): - clnsig_query["clnsig"]["$exists"] = True + clnsig_query["clnsig"][EXISTS] = True clnsig_query["clnsig"]["$ne"] = None return clnsig_query @@ -575,7 +569,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): { "$or": [ {"gnomad_frequency": {"$lt": float(gnomad)}}, - {"gnomad_frequency": {"$exists": False}}, + {"gnomad_frequency": {EXISTS: False}}, ] } ) @@ -613,7 +607,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): { "$or": [ {"swegen_mei_max": {"$lt": float(swegen)}}, - {"swegen_mei_max": {"$exists": False}}, + {"swegen_mei_max": {EXISTS: False}}, ] } ) @@ -622,7 +616,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): mongo_secondary_query.append( { "$or": [ - {criterion: {"$exists": False}}, + {criterion: {EXISTS: False}}, {criterion: {"$lt": query[criterion] + 1}}, ] } @@ -634,7 +628,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): spidex_query_or_part = [] if "not_reported" in spidex_human: - spidex_query_or_part.append({"spidex": {"$exists": False}}) + spidex_query_or_part.append({"spidex": {EXISTS: False}}) for spidex_level in SPIDEX_HUMAN: if spidex_level in spidex_human: @@ -678,7 +672,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): if criterion == "revel": revel = query["revel"] revel_query = {"revel": {"$gt": float(revel)}} - revel_query = {"$or": [revel_query, {"revel": {"$exists": False}}]} + revel_query = {"$or": [revel_query, {"revel": {EXISTS: False}}]} mongo_secondary_query.append(revel_query) @@ -686,7 +680,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): rank_score_query = { "$or": [ {"rank_score": {"$gte": float(query["rank_score"])}}, - {"rank_score": {"$exists": False}}, + {"rank_score": {EXISTS: False}}, ] } mongo_secondary_query.append(rank_score_query) @@ -696,7 +690,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): cadd_query = {"cadd_score": {"$gt": float(cadd)}} if query.get("cadd_inclusive") is True: - cadd_query = {"$or": [cadd_query, {"cadd_score": {"$exists": False}}]} + cadd_query = {"$or": [cadd_query, {"cadd_score": {EXISTS: False}}]} mongo_secondary_query.append(cadd_query) @@ -726,7 +720,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): size_query = { "$or": [ {"length": {"$lt": int(size)}}, - {"length": {"$exists": False}}, + {"length": {EXISTS: False}}, ] } @@ -737,7 +731,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): mongo_secondary_query.append({"sub_category": {"$in": svtype}}) if criterion == "decipher": - mongo_query["decipher"] = {"$exists": True} + mongo_query["decipher"] = {EXISTS: True} if criterion == "depth": mongo_secondary_query.append({"tumor.read_depth": {"$gt": query.get("depth")}}) @@ -750,7 +744,7 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): { "$or": [ {"somatic_score": {"$gt": query.get("somatic_score")}}, - {"somatic_score": {"$exists": False}}, + {"somatic_score": {EXISTS: False}}, ] } ) @@ -766,10 +760,10 @@ def secondary_query(self, query, mongo_query, secondary_filter=None): ) if criterion == "mvl_tag": - mongo_secondary_query.append({"mvl_tag": {"$exists": True}}) + mongo_secondary_query.append({"mvl_tag": {EXISTS: True}}) if criterion == "cosmic_tag": - mongo_secondary_query.append({"cosmic_ids": {"$exists": True}}) + mongo_secondary_query.append({"cosmic_ids": {EXISTS: True}}) mongo_secondary_query.append({"cosmic_ids": {"$ne": None}}) if criterion == "fusion_score": From 82a09629d38405f1befb33047d3a060f8001cba0 Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Wed, 6 Nov 2024 12:08:02 +0100 Subject: [PATCH 8/9] Fix function and test sccordingly --- scout/adapter/mongo/query.py | 54 +++++++++++++++++-------------- scout/constants/query_terms.py | 2 +- tests/adapter/mongo/test_query.py | 4 +-- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/scout/adapter/mongo/query.py b/scout/adapter/mongo/query.py index d1533207f0..01c0c03d7c 100644 --- a/scout/adapter/mongo/query.py +++ b/scout/adapter/mongo/query.py @@ -322,11 +322,13 @@ def build_query( for term in PRIMARY_CRITERIA: if query.get(term): primary_terms = True + break # check if any of the secondary criteria was specified in the query: for term in SECONDARY_CRITERIA: if query.get(term): secondary_terms = True + break if primary_terms is True: clinsign_filter = self.clinsig_query(query) @@ -397,7 +399,10 @@ def affected_inds_query(self, mongo_query, case_id, gt_query): for ind in case_inds: if ind["phenotype"] in [1, "unaffected"]: # 1=unaffected, 2=affected continue - affected_match = {"sample_id": ind["individual_id"], "genotype_call": gt_query} + affected_match = { + "sample_id": ind["individual_id"], + "genotype_call": gt_query, + } affected_query["$elemMatch"]["$or"].append(affected_match) if affected_query["$elemMatch"][ @@ -407,37 +412,36 @@ def affected_inds_query(self, mongo_query, case_id, gt_query): def clinsig_query(self, query: dict): """Add clinsig filter values to the mongo query object""" - LOG.debug("clinsig is a query parameter") - trusted_revision_level = TRUSTED_REVSTAT_LEVEL - rank = [] - str_rank = [] - - for item in query["clinsig"]: - rank.append(int(item)) - # search for human readable clinsig values in newer cases - rank.append(CLINSIG_MAP[int(item)]) - str_rank.append(CLINSIG_MAP[int(item)]) - - elem_match_or = { - "$or": [ - {"value": {"$in": rank}}, - {"value": re.compile("|".join(str_rank))}, - ] - } - if query.get("clinsig_confident_always_returned") is True: - clnsig_query = { - "clnsig": { + clnsig_query = {"clnsig": {}} + + if query.get("clinsig"): # If any CLinVar starts was selected in the form multiselect + rank = [] + str_rank = [] + for item in query["clinsig"]: + rank.append(int(item)) + # search for human readable clinsig values in newer cases + rank.append(CLINSIG_MAP[int(item)]) + str_rank.append(CLINSIG_MAP[int(item)]) + + elem_match_or = { + "$or": [ + {"value": {"$in": rank}}, + {"value": re.compile("|".join(str_rank))}, + ] + } + + if query.get("clinsig_confident_always_returned") is True: + clnsig_query["clnsig"] = { "$elemMatch": { "$and": [ elem_match_or, - {"revstat": re.compile("|".join(trusted_revision_level))}, + {"revstat": re.compile("|".join(TRUSTED_REVSTAT_LEVEL))}, ] } } - } - else: - clnsig_query = {"clnsig": {"$elemMatch": elem_match_or}} + else: + clnsig_query["clnsig"] = {"$elemMatch": elem_match_or} if query.get("clinvar_tag"): clnsig_query["clnsig"][EXISTS] = True diff --git a/scout/constants/query_terms.py b/scout/constants/query_terms.py index 5ef0dbd917..d3a80fe0a2 100644 --- a/scout/constants/query_terms.py +++ b/scout/constants/query_terms.py @@ -24,7 +24,7 @@ # added as a top level '$and'. # Otherwise, primary criteria are added as a high level '$or' and all secondary criteria # are joined together with them as a single lower level '$and'. -PRIMARY_CRITERIA = ["clinsig"] +PRIMARY_CRITERIA = ["clinsig", "clinvar_tag"] # Secondary, excluding filter criteria will hide variants in general, # but can be overridden by an including, major filter criteria diff --git a/tests/adapter/mongo/test_query.py b/tests/adapter/mongo/test_query.py index 44d42c6e8d..e2279f4cce 100644 --- a/tests/adapter/mongo/test_query.py +++ b/tests/adapter/mongo/test_query.py @@ -527,8 +527,8 @@ def test_build_has_clnsig( mongo_query = adapter.build_query(case_id, query=query) - assert {"clnsig": {"$exists": True}} in mongo_query["$and"] - assert {"clnsig": {"$ne": None}} in mongo_query["$and"] + assert mongo_query["clnsig"]["$exists"] is True + assert mongo_query["clnsig"]["$ne"] is None def test_build_has_cosmic_ids( From a87093bf0a38921c49c01b85cb3502b4aafa66a8 Mon Sep 17 00:00:00 2001 From: Chiara Rasi Date: Wed, 6 Nov 2024 12:10:07 +0100 Subject: [PATCH 9/9] typo --- scout/adapter/mongo/query.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scout/adapter/mongo/query.py b/scout/adapter/mongo/query.py index 01c0c03d7c..ee63cced79 100644 --- a/scout/adapter/mongo/query.py +++ b/scout/adapter/mongo/query.py @@ -415,7 +415,7 @@ def clinsig_query(self, query: dict): clnsig_query = {"clnsig": {}} - if query.get("clinsig"): # If any CLinVar starts was selected in the form multiselect + if query.get("clinsig"): # If any CLinVar significance was selected in the form multiselect rank = [] str_rank = [] for item in query["clinsig"]: