From 29bf44c6b955ff4d0a8a4add12dd976a6454cf4d Mon Sep 17 00:00:00 2001 From: mathieulemieux Date: Wed, 29 Nov 2023 14:35:04 -0800 Subject: [PATCH 1/3] cancerGeneListMatch and kbStatementRelated flags --- graphkb/genes.py | 18 ++++++++++-------- tests/test_genes.py | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/graphkb/genes.py b/graphkb/genes.py index afc2f80..aecf45a 100644 --- a/graphkb/genes.py +++ b/graphkb/genes.py @@ -392,8 +392,10 @@ def get_gene_information( Function is originally from pori_ipr_python::annotate.py - Gene flags (categories) are: ['cancerGene', 'cancerRelated', 'knownFusionPartner', 'knownSmallMutation', - 'oncogene', 'therapeuticAssociated', 'tumourSuppressor'] + Gene flags (categories) are: [ + 'cancerGeneListMatch', 'kbStatementRelated', 'knownFusionPartner', + 'knownSmallMutation', 'oncogene', 'therapeuticAssociated', 'tumourSuppressor' + ] Args: graphkb_conn ([type]): [description] @@ -401,7 +403,7 @@ def get_gene_information( Returns: List of gene_info dicts of form [{'name':, : True}] Keys of False values are simply omitted from ipr upload to reduce info transfer. - eg. [{'cancerRelated': True, + eg. [{'kbStatementRelated': True, 'knownFusionPartner': True, 'knownSmallMutation': True, 'name': 'TERT', @@ -423,7 +425,7 @@ def get_gene_information( statements = [s for s in statements if s.get("reviewStatus") != FAILED_REVIEW_STATUS] gene_flags: Dict[str, Set[str]] = { - "cancerRelated": set(), + "kbStatementRelated": set(), "knownFusionPartner": set(), "knownSmallMutation": set(), } @@ -432,9 +434,9 @@ def get_gene_information( for condition in statement["conditions"]: if not condition.get("reference1"): continue - gene_flags["cancerRelated"].add(condition["reference1"]) + gene_flags["kbStatementRelated"].add(condition["reference1"]) if condition["reference2"]: - gene_flags["cancerRelated"].add(condition["reference2"]) + gene_flags["kbStatementRelated"].add(condition["reference2"]) gene_flags["knownFusionPartner"].add(condition["reference1"]) gene_flags["knownFusionPartner"].add(condition["reference2"]) elif condition["@class"] == "PositionalVariant": @@ -444,8 +446,8 @@ def get_gene_information( gene_flags["oncogene"] = convert_to_rid_set(get_oncokb_oncogenes(graphkb_conn)) logger.info("fetching tumour supressors list") gene_flags["tumourSuppressor"] = convert_to_rid_set(get_oncokb_tumour_supressors(graphkb_conn)) - logger.info("fetching cancerGene list") - gene_flags["cancerGene"] = convert_to_rid_set(get_cancer_genes(graphkb_conn)) + logger.info("fetching cancerGeneListMatch list") + gene_flags["cancerGeneListMatch"] = convert_to_rid_set(get_cancer_genes(graphkb_conn)) logger.info("fetching therapeutic associated genes lists") gene_flags["therapeuticAssociated"] = convert_to_rid_set( diff --git a/tests/test_genes.py b/tests/test_genes.py index c5a5d96..b3670f4 100644 --- a/tests/test_genes.py +++ b/tests/test_genes.py @@ -246,10 +246,10 @@ def test_get_gene_information(conn): + CANNONICAL_THERAPY_GENES ): assert gene in [ - g["name"] for g in gene_info if g.get("cancerRelated") - ], f"Missed cancerRelated {gene}" + g["name"] for g in gene_info if g.get("kbStatementRelated") + ], f"Missed kbStatementRelated {gene}" for gene in CANONICAL_CG: assert gene in [ - g["name"] for g in gene_info if g.get("cancerGene") - ], f"Missed cancerGene {gene}" + g["name"] for g in gene_info if g.get("cancerGeneListMatch") + ], f"Missed cancerGeneListMatch {gene}" From 15e4a6ed0bb3d7b02fe34d44d1fbb5f14e2fbd69 Mon Sep 17 00:00:00 2001 From: Dustin Bleile Date: Fri, 1 Dec 2023 17:30:22 -0800 Subject: [PATCH 2/3] lint noqa of flake8 errors in test_statement.py from pytest fixture. --- tests/test_statement.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_statement.py b/tests/test_statement.py index aa032a6..fab9b0a 100644 --- a/tests/test_statement.py +++ b/tests/test_statement.py @@ -5,7 +5,9 @@ from graphkb import statement -from .test_match import conn +from .test_match import ( # noqa - 'F401 imported but unused' is being fooled by pytest conventions + conn, +) EXCLUDE_INTEGRATION_TESTS = os.environ.get("EXCLUDE_INTEGRATION_TESTS") == "1" @@ -86,7 +88,7 @@ def test_custom_categories(self, graphkb_conn): @pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests") class TestStatementMatch: - def test_truncating_categories(self, conn): + def test_truncating_categories(self, conn): # noqa - pytest fixture, not redefinition variant = {"@class": "CategoryVariant", "@rid": "#161:429", "displayName": "RB1 truncating"} statements = statement.get_statements_from_variants(conn, [variant]) assert statements From de5b69440fc569b6973fc0b2a72e09447bdbe520 Mon Sep 17 00:00:00 2001 From: Dustin Bleile Date: Fri, 1 Dec 2023 17:39:11 -0800 Subject: [PATCH 3/3] Release v1.15.0 New Feature: * KBDEV-1136 change cancergene and cancerrelated field-names to cancerGeneListMatch and kbStatementRelated --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index ac8829a..698fcef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ include_trailing_comma = true [metadata] name = graphkb url = https://github.com/bcgsc/pori_graphkb_python -version = 1.13.0 +version = 1.15.0 author_email = graphkb@bcgsc.ca description = python adapter for interacting with the GraphKB API long_description = file: README.md