Skip to content

Commit dc19024

Browse files
Merge pull request #74 from bcgsc/bugfix/KBDEV-1342-unreleased-dev-commits
Add KBDEV-1163 pori_graphkb_python changes (KBDEV-1342)
2 parents 091eddb + 1109883 commit dc19024

2 files changed

Lines changed: 140 additions & 8 deletions

File tree

tests/test_graphkb/data.py

Lines changed: 127 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
"""_summary_
2-
matches:
3-
Array of variants (diplayName and type) that MUST be matching, but not restricted to
4-
does_not_matches:
5-
Array of variants (diplayName and type) that MUST NOT be matching, but not restricted to
6-
"""
7-
81
# Screening structural variant to rule out small events [KBDEV_1056]
2+
#
3+
# matches:
4+
# Array of variants (diplayName and type) that MUST be matching, but not restricted to
5+
# does_not_matches:
6+
# Array of variants (diplayName and type) that MUST NOT be matching, but not restricted to
7+
#
98
structuralVariants = {
109
# Unambiguous structural variations
1110
"(FGFR3,BRCA2):fusion(g.1234567,g.1234567)": {
@@ -76,3 +75,124 @@
7675
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
7776
},
7877
}
78+
79+
# KBDEV-1163.
80+
# pos 0: a feature
81+
# pos 1: expected equivalences
82+
ensemblProteinSample = [
83+
(
84+
'EGFR',
85+
[
86+
'EGFR',
87+
'ERBB',
88+
'ENSG00000146648',
89+
'ENSG00000146648.17',
90+
'ENST00000275493',
91+
'ENST00000275493.6',
92+
'NM_001346897',
93+
'NM_001346897.2',
94+
'NP_001333826',
95+
'NP_001333826.1',
96+
],
97+
),
98+
(
99+
'NM_001346897',
100+
[
101+
'EGFR',
102+
'ERBB',
103+
'ENSG00000146648',
104+
'ENSG00000146648.17',
105+
'NM_001346897',
106+
'NM_001346897.2',
107+
'NP_001333826',
108+
'NP_001333826.1',
109+
],
110+
),
111+
(
112+
'NM_001346897.2',
113+
[
114+
'EGFR',
115+
'ERBB',
116+
'ENSG00000146648',
117+
'ENSG00000146648.17',
118+
'NM_001346897',
119+
'NM_001346897.2',
120+
'NP_001333826',
121+
'NP_001333826.1',
122+
],
123+
),
124+
(
125+
'NP_001333826',
126+
[
127+
'EGFR',
128+
'ERBB',
129+
'ENSG00000146648', # Warn: Versionized ENSG won't be returned due to API limitations
130+
'NM_001346897',
131+
'NM_001346897.2',
132+
'NP_001333826',
133+
'NP_001333826.1',
134+
],
135+
),
136+
(
137+
'NP_001333826.1',
138+
[
139+
'EGFR',
140+
'ERBB',
141+
'ENSG00000146648', # Warn: Versionized ENSG won't be returned due to API limitations
142+
'NM_001346897',
143+
'NM_001346897.2',
144+
'NP_001333826',
145+
'NP_001333826.1',
146+
],
147+
),
148+
(
149+
'ENSG00000146648',
150+
[
151+
'EGFR',
152+
'ERBB',
153+
'ENSG00000146648',
154+
'ENSG00000146648.17',
155+
'ENST00000275493',
156+
'ENST00000275493.6',
157+
'NM_001346897',
158+
'NM_001346897.2',
159+
'NP_001333826', # Warn: Versionized NP won't be returned due to API limitations
160+
],
161+
),
162+
(
163+
'ENSG00000146648.17',
164+
[
165+
'EGFR',
166+
'ERBB',
167+
'ENSG00000146648',
168+
'ENSG00000146648.17',
169+
'ENST00000275493',
170+
'ENST00000275493.6',
171+
'NM_001346897',
172+
'NM_001346897.2',
173+
'NP_001333826', # Warn: Versionized NP won't be returned due to API limitations
174+
],
175+
),
176+
(
177+
'ENST00000275493',
178+
[
179+
'EGFR',
180+
'ERBB',
181+
'ENSG00000146648',
182+
'ENSG00000146648.17',
183+
'ENST00000275493',
184+
'ENST00000275493.6',
185+
],
186+
),
187+
(
188+
'ENST00000275493.6',
189+
[
190+
'EGFR',
191+
'ERBB',
192+
'ENSG00000146648',
193+
'ENSG00000146648.17',
194+
'ENST00000275493',
195+
'ENST00000275493.6',
196+
],
197+
),
198+
]

tests/test_graphkb/test_match.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pori_python.graphkb.util import FeatureNotFoundError
1414

1515
# Test datasets
16-
from .data import structuralVariants
16+
from .data import ensemblProteinSample, structuralVariants
1717

1818
EXCLUDE_BCGSC_TESTS = os.environ.get("EXCLUDE_BCGSC_TESTS") == "1"
1919
EXCLUDE_INTEGRATION_TESTS = os.environ.get("EXCLUDE_INTEGRATION_TESTS") == "1"
@@ -101,6 +101,18 @@ def test_checks_by_source_id_kras(self, conn):
101101
]
102102
assert "KRAS" in kras
103103

104+
# KBDEV-1163
105+
# Testing if the addition of Ensembl protein Features are limiting results
106+
# returned by get_equivalent_features() since SimilatTo queryType queries
107+
# aren't traversing the graph to it's whole depth.
108+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding data-specific test")
109+
def test_ensembl_protein(self, conn):
110+
for feature, expected in ensemblProteinSample:
111+
equivalent_features = match.get_equivalent_features(conn, feature)
112+
equivalent_features = [el['displayName'] for el in equivalent_features]
113+
for equivalent_feature in expected:
114+
assert equivalent_feature in equivalent_features
115+
104116

105117
class TestMatchCopyVariant:
106118
def test_bad_category(self, conn):

0 commit comments

Comments
 (0)