Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit f3a17ae

Browse files
authored
Merge pull request #113 from bcgsc/release/v1.15.0_kbStatementRelated_genes
Release/v1.15.0 kb statement related genes
2 parents 37f6528 + db08658 commit f3a17ae

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

graphkb/genes.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,18 @@ def get_gene_information(
392392
393393
Function is originally from pori_ipr_python::annotate.py
394394
395-
Gene flags (categories) are: ['cancerGene', 'cancerRelated', 'knownFusionPartner', 'knownSmallMutation',
396-
'oncogene', 'therapeuticAssociated', 'tumourSuppressor']
395+
Gene flags (categories) are: [
396+
'cancerGeneListMatch', 'kbStatementRelated', 'knownFusionPartner',
397+
'knownSmallMutation', 'oncogene', 'therapeuticAssociated', 'tumourSuppressor'
398+
]
397399
398400
Args:
399401
graphkb_conn ([type]): [description]
400402
gene_names ([type]): [description]
401403
Returns:
402404
List of gene_info dicts of form [{'name':<gene_str>, <flag>: True}]
403405
Keys of False values are simply omitted from ipr upload to reduce info transfer.
404-
eg. [{'cancerRelated': True,
406+
eg. [{'kbStatementRelated': True,
405407
'knownFusionPartner': True,
406408
'knownSmallMutation': True,
407409
'name': 'TERT',
@@ -423,7 +425,7 @@ def get_gene_information(
423425
statements = [s for s in statements if s.get("reviewStatus") != FAILED_REVIEW_STATUS]
424426

425427
gene_flags: Dict[str, Set[str]] = {
426-
"cancerRelated": set(),
428+
"kbStatementRelated": set(),
427429
"knownFusionPartner": set(),
428430
"knownSmallMutation": set(),
429431
}
@@ -432,9 +434,9 @@ def get_gene_information(
432434
for condition in statement["conditions"]:
433435
if not condition.get("reference1"):
434436
continue
435-
gene_flags["cancerRelated"].add(condition["reference1"])
437+
gene_flags["kbStatementRelated"].add(condition["reference1"])
436438
if condition["reference2"]:
437-
gene_flags["cancerRelated"].add(condition["reference2"])
439+
gene_flags["kbStatementRelated"].add(condition["reference2"])
438440
gene_flags["knownFusionPartner"].add(condition["reference1"])
439441
gene_flags["knownFusionPartner"].add(condition["reference2"])
440442
elif condition["@class"] == "PositionalVariant":
@@ -444,8 +446,8 @@ def get_gene_information(
444446
gene_flags["oncogene"] = convert_to_rid_set(get_oncokb_oncogenes(graphkb_conn))
445447
logger.info("fetching tumour supressors list")
446448
gene_flags["tumourSuppressor"] = convert_to_rid_set(get_oncokb_tumour_supressors(graphkb_conn))
447-
logger.info("fetching cancerGene list")
448-
gene_flags["cancerGene"] = convert_to_rid_set(get_cancer_genes(graphkb_conn))
449+
logger.info("fetching cancerGeneListMatch list")
450+
gene_flags["cancerGeneListMatch"] = convert_to_rid_set(get_cancer_genes(graphkb_conn))
449451

450452
logger.info("fetching therapeutic associated genes lists")
451453
gene_flags["therapeuticAssociated"] = convert_to_rid_set(

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include_trailing_comma = true
1010
[metadata]
1111
name = graphkb
1212
url = https://github.com/bcgsc/pori_graphkb_python
13-
version = 1.14.0
13+
version = 1.15.0
1414
author_email = graphkb@bcgsc.ca
1515
description = python adapter for interacting with the GraphKB API
1616
long_description = file: README.md

tests/test_genes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ def test_get_gene_information(conn):
246246
+ CANNONICAL_THERAPY_GENES
247247
):
248248
assert gene in [
249-
g["name"] for g in gene_info if g.get("cancerRelated")
250-
], f"Missed cancerRelated {gene}"
249+
g["name"] for g in gene_info if g.get("kbStatementRelated")
250+
], f"Missed kbStatementRelated {gene}"
251251

252252
for gene in CANONICAL_CG:
253253
assert gene in [
254-
g["name"] for g in gene_info if g.get("cancerGene")
255-
], f"Missed cancerGene {gene}"
254+
g["name"] for g in gene_info if g.get("cancerGeneListMatch")
255+
], f"Missed cancerGeneListMatch {gene}"

tests/test_statement.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
from graphkb import statement
77

8-
from .test_match import conn
8+
from .test_match import ( # noqa - 'F401 imported but unused' is being fooled by pytest conventions
9+
conn,
10+
)
911

1012
EXCLUDE_INTEGRATION_TESTS = os.environ.get("EXCLUDE_INTEGRATION_TESTS") == "1"
1113

@@ -86,7 +88,7 @@ def test_custom_categories(self, graphkb_conn):
8688

8789
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
8890
class TestStatementMatch:
89-
def test_truncating_categories(self, conn):
91+
def test_truncating_categories(self, conn): # noqa - pytest fixture, not redefinition
9092
variant = {"@class": "CategoryVariant", "@rid": "#161:429", "displayName": "RB1 truncating"}
9193
statements = statement.get_statements_from_variants(conn, [variant])
9294
assert statements

0 commit comments

Comments
 (0)