pori-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pori_python/__init__.py +1 -0
- pori_python/graphkb/__init__.py +2 -0
- pori_python/graphkb/constants.py +220 -0
- pori_python/graphkb/genes.py +540 -0
- pori_python/graphkb/match.py +710 -0
- pori_python/graphkb/py.typed +0 -0
- pori_python/graphkb/statement.py +48 -0
- pori_python/graphkb/util.py +523 -0
- pori_python/graphkb/vocab.py +198 -0
- pori_python/ipr/__init__.py +0 -0
- pori_python/ipr/annotate.py +373 -0
- pori_python/ipr/connection.py +214 -0
- pori_python/ipr/constants.py +9 -0
- pori_python/ipr/inputs.py +593 -0
- pori_python/ipr/ipr.py +390 -0
- pori_python/ipr/main.py +512 -0
- pori_python/ipr/py.typed +0 -0
- pori_python/ipr/summary.py +412 -0
- pori_python/ipr/therapeutic_options.py +83 -0
- pori_python/ipr/util.py +173 -0
- pori_python/types.py +177 -0
- pori_python-0.1.0.dist-info/LICENSE +674 -0
- pori_python-0.1.0.dist-info/METADATA +151 -0
- pori_python-0.1.0.dist-info/RECORD +49 -0
- pori_python-0.1.0.dist-info/WHEEL +5 -0
- pori_python-0.1.0.dist-info/dependency_links.txt +1 -0
- pori_python-0.1.0.dist-info/entry_points.txt +2 -0
- pori_python-0.1.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/test_graphkb/__init__.py +0 -0
- tests/test_graphkb/data.py +78 -0
- tests/test_graphkb/test_genes.py +306 -0
- tests/test_graphkb/test_graphkb.py +32 -0
- tests/test_graphkb/test_match.py +662 -0
- tests/test_graphkb/test_statement.py +100 -0
- tests/test_graphkb/test_util.py +151 -0
- tests/test_graphkb/test_vocab.py +85 -0
- tests/test_ipr/__init__.py +0 -0
- tests/test_ipr/constants.py +3 -0
- tests/test_ipr/test_annotate.py +149 -0
- tests/test_ipr/test_connection.py +97 -0
- tests/test_ipr/test_inputs.py +295 -0
- tests/test_ipr/test_ipr.py +338 -0
- tests/test_ipr/test_main.py +154 -0
- tests/test_ipr/test_probe.py +72 -0
- tests/test_ipr/test_summary.py +157 -0
- tests/test_ipr/test_upload.py +274 -0
- tests/test_ipr/test_util.py +29 -0
- tests/test_ipr/util.py +9 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pori_python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Home-page: https://github.com/bcgsc/pori_python
|
|
5
|
+
Author-email: dat@bcgsc.ca
|
|
6
|
+
Maintainer-email: dat@bcgsc.ca
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: biopython
|
|
11
|
+
Requires-Dist: jsonschema
|
|
12
|
+
Requires-Dist: pandas>=1.1.0
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Requires-Dist: tqdm
|
|
15
|
+
Requires-Dist: typing-extensions<5,>=3.7.4.2
|
|
16
|
+
Provides-Extra: deploy
|
|
17
|
+
Requires-Dist: twine; extra == "deploy"
|
|
18
|
+
Requires-Dist: wheel; extra == "deploy"
|
|
19
|
+
Requires-Dist: m2r; extra == "deploy"
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: twine; extra == "dev"
|
|
22
|
+
Requires-Dist: wheel; extra == "dev"
|
|
23
|
+
Requires-Dist: m2r; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-runner; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
27
|
+
Requires-Dist: mkdocs; extra == "dev"
|
|
28
|
+
Requires-Dist: mkdocs-material; extra == "dev"
|
|
29
|
+
Requires-Dist: mkdocs-redirects; extra == "dev"
|
|
30
|
+
Requires-Dist: markdown-refdocs; extra == "dev"
|
|
31
|
+
Requires-Dist: flake8; extra == "dev"
|
|
32
|
+
Requires-Dist: black; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8-annotations; extra == "dev"
|
|
34
|
+
Requires-Dist: isort; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy; extra == "dev"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: mkdocs; extra == "docs"
|
|
38
|
+
Requires-Dist: mkdocs-material; extra == "docs"
|
|
39
|
+
Requires-Dist: markdown-refdocs; extra == "docs"
|
|
40
|
+
Requires-Dist: mkdocs-redirects; extra == "docs"
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-runner; extra == "test"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# PORI Python Adaptor
|
|
48
|
+
|
|
49
|
+
 [](https://codecov.io/gh/bcgsc/pori_python)
|
|
50
|
+
|
|
51
|
+
This repository is part of the [Platform for Oncogenomic Reporting and Interpretation (PORI)](https://bcgsc.github.io/pori/).
|
|
52
|
+
|
|
53
|
+
This is a python adaptor package for querying the GraphKB API and IPR API.
|
|
54
|
+
|
|
55
|
+
This python tool takes in variant inputs as tab-delimited files and annotates them using GraphKB.
|
|
56
|
+
The resulting output is uploaded to IPR as a report. Additional report content such as images and
|
|
57
|
+
metadata can be passed to be included in the report upload.
|
|
58
|
+
|
|
59
|
+
For documentation on how to create reports using the IPR adaptor, see the [main documentation site](https://bcgsc.github.io/pori/) for the platform. For the GraphKB adaptor, see the [user manual](https://bcgsc.github.io/pori/graphkb/scripting/).
|
|
60
|
+
|
|
61
|
+
- [Getting Started](#getting-started)
|
|
62
|
+
- [Install (For developers)](#install-for-developers)
|
|
63
|
+
- [Documentation](#documentation)
|
|
64
|
+
- [Deployment (Publishing)](#deployment-publishing)
|
|
65
|
+
|
|
66
|
+
## Getting Started
|
|
67
|
+
|
|
68
|
+
### Install (For developers)
|
|
69
|
+
|
|
70
|
+
clone this repository
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/bcgsc/pori_python.git
|
|
74
|
+
cd pori_python
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
create a virtual environment
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python3 -m venv venv
|
|
81
|
+
source venv/bin/activate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
install the package and its development dependencies
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install -U pip setuptools
|
|
88
|
+
pip install -e .[dev]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Run the tests:
|
|
92
|
+
|
|
93
|
+
Export usernames, passwords, and set test options.
|
|
94
|
+
|
|
95
|
+
Note that IPR tests will try to use the BCGSC production GraphKB API by default.
|
|
96
|
+
If you want to test interaction with a different instance, you will need to
|
|
97
|
+
set the GraphKB variables.
|
|
98
|
+
|
|
99
|
+
Set EXCLUDE vars to 1 if you don't want to run these tests.
|
|
100
|
+
ONCOKB and BCGSC tests are enabled by default.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
export IPR_USER='pori_admin'
|
|
104
|
+
export IPR_PASS='pori_admin'
|
|
105
|
+
export IPR_URL='http://localhost:8081/api'
|
|
106
|
+
export GRAPHKB_USER='pori_admin'
|
|
107
|
+
export GRAPHKB_PASS='pori_admin'
|
|
108
|
+
export GRAPHKB_URL='http://localhost:8080/api'
|
|
109
|
+
EXCLUDE_BCGSC_TESTS = 1
|
|
110
|
+
EXCLUDE_ONCOKB_TESTS = 1
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If you want to run tests that upload reports to a live IPR instance,
|
|
114
|
+
specify the url of the IPR API you want to use and set the test var to 1.
|
|
115
|
+
These tests are disabled by default.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
export IPR_TEST_URL='http://localhost:8081/api'
|
|
119
|
+
INCLUDE_UPLOAD_TESTS = 1
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pytest tests
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
The user documentation for this tool is hosted with the [main documentation site](https://bcgsc.github.io/pori/).
|
|
129
|
+
|
|
130
|
+
Developers: Any updates to this tool should be edited and reflected in the main site documentation as well.
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## Deployment (Publishing)
|
|
134
|
+
|
|
135
|
+
Install the deployment dependencies
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pip install .[deploy]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Build the distribution files
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python setup.py install sdist bdist_wheel
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Upload the distibutions to the package server (`-r` is defined in your pypirc)
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
twine upload -r bcgsc dist/*
|
|
151
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
pori_python/__init__.py,sha256=JNdieKCb80mwexMRCRFhiDDtiGMmwpy0GtXoopXpdwo,41
|
|
2
|
+
pori_python/types.py,sha256=J71cVvuajhUTZvanCsX4qNpezmUiEgn46psHo1SHZNE,4178
|
|
3
|
+
pori_python/graphkb/__init__.py,sha256=uAA2GTzBvASVvr47UNpe2W2II8-vc4xFa7XO-aUUM_A,107
|
|
4
|
+
pori_python/graphkb/constants.py,sha256=r4nVpxRle_7Ttde57sfQkFq0RD9W9C-hl5n80wllyyk,5948
|
|
5
|
+
pori_python/graphkb/genes.py,sha256=YA1spSrtcF7lxosQP5joPqpohx8toqhMbf4MRe2fcpk,20150
|
|
6
|
+
pori_python/graphkb/match.py,sha256=d8TpHGE6IrHv-sEmI8ieo5ftuH3SXSpD_RDLs4Rg0qY,24805
|
|
7
|
+
pori_python/graphkb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
pori_python/graphkb/statement.py,sha256=mnFC7V6vBtl6jn5EOlQM2ZT2E8zEa0VX1xQzsHMgg8s,1743
|
|
9
|
+
pori_python/graphkb/util.py,sha256=ar-d-I1EM7B3MBJRkgs3hpRdozOgQZYJ-PfgmIGJ8IU,18816
|
|
10
|
+
pori_python/graphkb/vocab.py,sha256=platIbqKAi5iPQ-it2cssq-ExT9xvQXgSMZdoEb7Opw,6394
|
|
11
|
+
pori_python/ipr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
pori_python/ipr/annotate.py,sha256=AU_wLA5-w1RhpfaZQddGCDLPCCoJ2vjczUL3qdCyyg4,14107
|
|
13
|
+
pori_python/ipr/connection.py,sha256=eRLOfPZlR86BmHfbcxer3JWHK9SkKWv20YTN0Ptnt_g,7817
|
|
14
|
+
pori_python/ipr/constants.py,sha256=j9qgEx7iWEQZ4K-BdrfqRnGrilQX5GKKx1_LmThO080,508
|
|
15
|
+
pori_python/ipr/inputs.py,sha256=cLrEtueRjwXXmYffhmFY2CMIuMzfRj5fSESr-NoL0VY,20374
|
|
16
|
+
pori_python/ipr/ipr.py,sha256=MkKBnCQZ48yKupZPY29YYrXNeJI-cV8eD-a12zLQpms,16329
|
|
17
|
+
pori_python/ipr/main.py,sha256=QeVxXwlAuOV989pw920UOqaRzUUJ3l1jQym0GJxf2Wo,20089
|
|
18
|
+
pori_python/ipr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
pori_python/ipr/summary.py,sha256=fCCIIhXolMzjxFyG_7eedUKx5sblClmY41AlGi594Fc,15017
|
|
20
|
+
pori_python/ipr/therapeutic_options.py,sha256=AGg2IwR9A5yr8dk6PeGtAV0HcD1tlXyVdVsJq8rQbF0,2759
|
|
21
|
+
pori_python/ipr/util.py,sha256=IrxyXlyX_aluJHhhKzczGyz5SfVgSBrDKywmpVokwlE,5815
|
|
22
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
tests/test_graphkb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
tests/test_graphkb/data.py,sha256=WDJ6Esc53-GwycOLk8ZDWCrnlwdttfjR-T5rVu2QxNg,3215
|
|
25
|
+
tests/test_graphkb/test_genes.py,sha256=jm5mcnzID7xhYi7Ui_zy9lKl-8ha75M4LiWl-pYHtRs,9860
|
|
26
|
+
tests/test_graphkb/test_graphkb.py,sha256=8tZSUewgabviOQlVI6NQzPZDYxRndfT4Hs44xCpcOM4,1066
|
|
27
|
+
tests/test_graphkb/test_match.py,sha256=xzdwby79F13dhsOyLR7jRD7VUWkrOazKN_zGuH0P4sA,26960
|
|
28
|
+
tests/test_graphkb/test_statement.py,sha256=QZr1TZkqyM4H7zQKyw6UK9AeKvURgusiCGk0Wy4uaso,3738
|
|
29
|
+
tests/test_graphkb/test_util.py,sha256=cH4CAId5waVjqJGdetyVNc3qkmgFfExCgK6aAvRHuis,5807
|
|
30
|
+
tests/test_graphkb/test_vocab.py,sha256=cYVw7uQIgn_WqMINafdQ4Ipat7O-D8b3ZwQf4ksG-jM,2619
|
|
31
|
+
tests/test_ipr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
+
tests/test_ipr/constants.py,sha256=inNuA40LmDM2XYaCmi1eN0aAXponCDp9VTSoonRvnUA,90
|
|
33
|
+
tests/test_ipr/test_annotate.py,sha256=q1DUFsZ9j_XiX9SiIjV3Lf2T0A_rnrjKGO-2eCkLqPg,6148
|
|
34
|
+
tests/test_ipr/test_connection.py,sha256=lM00RcxG919Ydty1ToXUVQlCWSWAlDWxyEKryl1PTcY,3620
|
|
35
|
+
tests/test_ipr/test_inputs.py,sha256=DV2BKgCl7oNHH9f7kIy3_gaDiPQvfdRv9fXTQRelqBw,11286
|
|
36
|
+
tests/test_ipr/test_ipr.py,sha256=FGBv5Hlbt4e8yHIyk5QYKQ_Mru7_BEKlpq6tz_ZaH10,11172
|
|
37
|
+
tests/test_ipr/test_main.py,sha256=0DNYFl-mvVh4rWxQ5ftOCV0TVk0rgcYK7dBHiLuCdbE,5997
|
|
38
|
+
tests/test_ipr/test_probe.py,sha256=tHIxUXQj9CWr1XOY8IgakEaY5uFsM1FeZX84sndCNv4,2813
|
|
39
|
+
tests/test_ipr/test_summary.py,sha256=N3OjzroG8Wpgv4c15g5oLVCL8wqcVy7Icl_ypWKR2GE,6569
|
|
40
|
+
tests/test_ipr/test_upload.py,sha256=jQXic9AQxh0O_vdzXlbEXzJ_qKoCF-rJruNBRak3ZsI,11655
|
|
41
|
+
tests/test_ipr/test_util.py,sha256=jDRQC33-rPfW5LwXpvYCr24k-EO-IheOw4C-WSu20rQ,970
|
|
42
|
+
tests/test_ipr/util.py,sha256=Sroyv6BmpbtnskpxVbCnnQ8jp8ScIbmX1iJzbNU58Bs,317
|
|
43
|
+
pori_python-0.1.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
44
|
+
pori_python-0.1.0.dist-info/METADATA,sha256=Y213q0suKrdp-926OQLE0FFTMUeUgK8x5lZbpWgsKRY,4496
|
|
45
|
+
pori_python-0.1.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
46
|
+
pori_python-0.1.0.dist-info/dependency_links.txt,sha256=N1F-Xz3GaBn2H1p7uKzhkhKCQV8QVR0t76XD6wmFtXA,3
|
|
47
|
+
pori_python-0.1.0.dist-info/entry_points.txt,sha256=lJjLJkCKAT9eFf0y6PAWsyZ1fpxqQbcUXUFU4-oCEmY,63
|
|
48
|
+
pori_python-0.1.0.dist-info/top_level.txt,sha256=DzVhthvDAqzUWnD04dLEpQMreW1_Ya_IoIBBbIwCiLI,18
|
|
49
|
+
pori_python-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
tests/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
|
|
8
|
+
# Screening structural variant to rule out small events [KBDEV_1056]
|
|
9
|
+
structuralVariants = {
|
|
10
|
+
# Unambiguous structural variations
|
|
11
|
+
"(FGFR3,BRCA2):fusion(g.1234567,g.1234567)": {
|
|
12
|
+
"matches": {
|
|
13
|
+
"displayName": ["FGFR3 fusion", "FGFR3 rearrangement"],
|
|
14
|
+
"type": ["fusion", "rearrangement"],
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
# ambiguous structural variations -> structural
|
|
18
|
+
"FGFR3:c.1200_1300dup": {
|
|
19
|
+
"matches": {
|
|
20
|
+
"displayName": ["FGFR3 mutation", "FGFR3 rearrangement"],
|
|
21
|
+
"type": ["mutation", "rearrangement"],
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"FGFR3:c.1200_1201insACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT": {
|
|
25
|
+
"matches": {
|
|
26
|
+
"displayName": ["FGFR3 mutation", "FGFR3 rearrangement"],
|
|
27
|
+
"type": ["mutation", "rearrangement"],
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"FGFR3:g.5000_5100del": {
|
|
31
|
+
"matches": {
|
|
32
|
+
"displayName": ["FGFR3 mutation", "FGFR3 rearrangement"],
|
|
33
|
+
"type": ["mutation", "rearrangement"],
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"FGFR3:c.1200_1300delinsA": {
|
|
37
|
+
"matches": {
|
|
38
|
+
"displayName": ["FGFR3 mutation", "FGFR3 rearrangement"],
|
|
39
|
+
"type": ["mutation", "rearrangement"],
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"FGFR3:c.1200delinsACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGT": {
|
|
43
|
+
"matches": {
|
|
44
|
+
"displayName": ["FGFR3 mutation", "FGFR3 rearrangement"],
|
|
45
|
+
"type": ["mutation", "rearrangement"],
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
# ambiguous structural variations -> non-structural
|
|
49
|
+
"FGFR3:c.1200dup": {
|
|
50
|
+
"matches": {"displayName": ["FGFR3 mutation"], "type": ["mutation"]},
|
|
51
|
+
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
|
|
52
|
+
},
|
|
53
|
+
"FGFR3:c.1200_1201insA": {
|
|
54
|
+
"matches": {"displayName": ["FGFR3 mutation"], "type": ["mutation"]},
|
|
55
|
+
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
|
|
56
|
+
},
|
|
57
|
+
"FGFR3:g.5000del": {
|
|
58
|
+
"matches": {"displayName": ["FGFR3 mutation"], "type": ["mutation"]},
|
|
59
|
+
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
|
|
60
|
+
},
|
|
61
|
+
"FGFR3:c.1200delinsA": {
|
|
62
|
+
"matches": {"displayName": ["FGFR3 mutation"], "type": ["mutation"]},
|
|
63
|
+
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
|
|
64
|
+
},
|
|
65
|
+
"STK11:e.1_100del": {
|
|
66
|
+
"matches": {"displayName": ["STK11 mutation"], "type": ["mutation"]},
|
|
67
|
+
"does_not_matches": {"displayName": ["STK11 deletion"], "type": ["deletion"]},
|
|
68
|
+
},
|
|
69
|
+
"STK11:i.1_100del": {
|
|
70
|
+
"matches": {"displayName": ["STK11 mutation"], "type": ["mutation"]},
|
|
71
|
+
"does_not_matches": {"displayName": ["STK11 deletion"], "type": ["deletion"]},
|
|
72
|
+
},
|
|
73
|
+
# non-structural variations
|
|
74
|
+
"FGFR3:c.1200C>A": {
|
|
75
|
+
"matches": {"displayName": ["FGFR3 mutation"], "type": ["mutation"]},
|
|
76
|
+
"does_not_matches": {"displayName": ["FGFR3 rearrangement"], "type": ["rearrangement"]},
|
|
77
|
+
},
|
|
78
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests here depend on specific data in GraphKB which can change. To avoid this, expected/stable values are chosen
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from pori_python.graphkb import GraphKBConnection
|
|
9
|
+
from pori_python.graphkb.genes import (
|
|
10
|
+
get_cancer_genes,
|
|
11
|
+
get_cancer_predisposition_info,
|
|
12
|
+
get_gene_information,
|
|
13
|
+
get_gene_linked_cancer_predisposition_info,
|
|
14
|
+
get_gene_linked_pharmacogenomic_info,
|
|
15
|
+
get_genes_from_variant_types,
|
|
16
|
+
get_oncokb_oncogenes,
|
|
17
|
+
get_oncokb_tumour_supressors,
|
|
18
|
+
get_pharmacogenomic_info,
|
|
19
|
+
get_preferred_gene_name,
|
|
20
|
+
get_therapeutic_associated_genes,
|
|
21
|
+
)
|
|
22
|
+
from pori_python.graphkb.util import get_rid
|
|
23
|
+
|
|
24
|
+
EXCLUDE_INTEGRATION_TESTS = os.environ.get("EXCLUDE_INTEGRATION_TESTS") == "1"
|
|
25
|
+
EXCLUDE_BCGSC_TESTS = os.environ.get("EXCLUDE_BCGSC_TESTS") == "1"
|
|
26
|
+
EXCLUDE_ONCOKB_TESTS = os.environ.get("EXCLUDE_ONCOKB_TESTS") == "1"
|
|
27
|
+
|
|
28
|
+
CANONICAL_ONCOGENES = ["kras", "nras", "alk"]
|
|
29
|
+
CANONICAL_TS = ["cdkn2a", "tp53"]
|
|
30
|
+
CANONICAL_CG = ["alb"]
|
|
31
|
+
CANONICAL_FUSION_GENES = ["alk", "ewsr1", "fli1"]
|
|
32
|
+
CANONICAL_STRUCTURAL_VARIANT_GENES = ["brca1", "dpyd", "pten"]
|
|
33
|
+
CANNONICAL_THERAPY_GENES = ["erbb2", "brca2", "egfr"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
PHARMACOGENOMIC_INITIAL_GENES = [
|
|
37
|
+
"ACYP2",
|
|
38
|
+
"CEP72",
|
|
39
|
+
# 'CYP26B1', # defined as hgvsGenomic chr2:g.233760235_233760235nc_000002.12:g.233760235ta[7]>ta[8]
|
|
40
|
+
"DPYD",
|
|
41
|
+
"NUDT15",
|
|
42
|
+
"RARG",
|
|
43
|
+
"SLC28A3",
|
|
44
|
+
"TPMT",
|
|
45
|
+
"UGT1A6",
|
|
46
|
+
]
|
|
47
|
+
CANCER_PREDISP_INITIAL_GENES = [
|
|
48
|
+
"AKT1",
|
|
49
|
+
"APC",
|
|
50
|
+
"ATM",
|
|
51
|
+
"AXIN2",
|
|
52
|
+
"BAP1",
|
|
53
|
+
"BLM",
|
|
54
|
+
"BMPR1A",
|
|
55
|
+
"BRCA1",
|
|
56
|
+
"BRCA2",
|
|
57
|
+
"BRIP1",
|
|
58
|
+
"CBL",
|
|
59
|
+
"CDH1",
|
|
60
|
+
"CDK4",
|
|
61
|
+
"CDKN2A",
|
|
62
|
+
"CHEK2",
|
|
63
|
+
"DICER1",
|
|
64
|
+
"EGFR",
|
|
65
|
+
"EPCAM",
|
|
66
|
+
"ETV6",
|
|
67
|
+
"EZH2",
|
|
68
|
+
"FH",
|
|
69
|
+
"FLCN",
|
|
70
|
+
"GATA2",
|
|
71
|
+
"HRAS",
|
|
72
|
+
"KIT",
|
|
73
|
+
"MEN1",
|
|
74
|
+
"MET",
|
|
75
|
+
"MLH1",
|
|
76
|
+
"MSH2",
|
|
77
|
+
"MSH6",
|
|
78
|
+
"MUTYH",
|
|
79
|
+
"NBN",
|
|
80
|
+
"NF1",
|
|
81
|
+
"PALB2",
|
|
82
|
+
"PDGFRA",
|
|
83
|
+
"PMS2",
|
|
84
|
+
"PTCH1",
|
|
85
|
+
"PTEN",
|
|
86
|
+
"PTPN11",
|
|
87
|
+
"RAD51C",
|
|
88
|
+
"RAD51D",
|
|
89
|
+
"RB1",
|
|
90
|
+
"RET",
|
|
91
|
+
"RUNX1",
|
|
92
|
+
"SDHA",
|
|
93
|
+
"SDHB",
|
|
94
|
+
"SDHC",
|
|
95
|
+
"SDHD",
|
|
96
|
+
"SMAD4",
|
|
97
|
+
"SMARCA4",
|
|
98
|
+
"STK11",
|
|
99
|
+
"TP53",
|
|
100
|
+
"TSC1",
|
|
101
|
+
"TSC2",
|
|
102
|
+
"VHL",
|
|
103
|
+
"WT1",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@pytest.fixture(scope="module")
|
|
108
|
+
def conn():
|
|
109
|
+
conn = GraphKBConnection()
|
|
110
|
+
conn.login(os.environ["GRAPHKB_USER"], os.environ["GRAPHKB_PASS"])
|
|
111
|
+
return conn
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@pytest.mark.skipif(EXCLUDE_ONCOKB_TESTS, reason="excluding tests that depend on oncokb data")
|
|
115
|
+
def test_oncogene(conn):
|
|
116
|
+
result = get_oncokb_oncogenes(conn)
|
|
117
|
+
names = {row["name"] for row in result}
|
|
118
|
+
for gene in CANONICAL_ONCOGENES:
|
|
119
|
+
assert gene in names
|
|
120
|
+
for gene in CANONICAL_TS:
|
|
121
|
+
assert gene not in names
|
|
122
|
+
for gene in CANONICAL_CG:
|
|
123
|
+
assert gene not in names
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@pytest.mark.skipif(EXCLUDE_ONCOKB_TESTS, reason="excluding tests that depend on oncokb data")
|
|
127
|
+
def test_tumour_supressors(conn):
|
|
128
|
+
result = get_oncokb_tumour_supressors(conn)
|
|
129
|
+
names = {row["name"] for row in result}
|
|
130
|
+
for gene in CANONICAL_TS:
|
|
131
|
+
assert gene in names
|
|
132
|
+
for gene in CANONICAL_ONCOGENES:
|
|
133
|
+
assert gene not in names
|
|
134
|
+
for gene in CANONICAL_CG:
|
|
135
|
+
assert gene not in names
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@pytest.mark.skipif(EXCLUDE_ONCOKB_TESTS, reason="excluding tests that depend on oncokb data")
|
|
139
|
+
@pytest.mark.skipif(
|
|
140
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (tso500 not available)"
|
|
141
|
+
)
|
|
142
|
+
def test_cancer_genes(conn):
|
|
143
|
+
result = get_cancer_genes(conn)
|
|
144
|
+
names = {row["name"] for row in result}
|
|
145
|
+
for gene in CANONICAL_CG:
|
|
146
|
+
assert gene in names
|
|
147
|
+
for gene in CANONICAL_TS:
|
|
148
|
+
assert gene not in names
|
|
149
|
+
for gene in CANONICAL_ONCOGENES:
|
|
150
|
+
assert gene not in names
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@pytest.mark.skipif(
|
|
154
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (requires CGL loader))"
|
|
155
|
+
)
|
|
156
|
+
def test_get_pharmacogenomic_info(conn):
|
|
157
|
+
genes, matches = get_pharmacogenomic_info(conn)
|
|
158
|
+
for gene in PHARMACOGENOMIC_INITIAL_GENES:
|
|
159
|
+
assert gene in genes, f"{gene} not found in get_pharmacogenomic_info"
|
|
160
|
+
for rid, variant_display in matches.items():
|
|
161
|
+
if variant_display.startswith(gene):
|
|
162
|
+
break
|
|
163
|
+
else: # no break called
|
|
164
|
+
# failing on this version of the func; addressed in 'new' version
|
|
165
|
+
if gene == "ACYP2":
|
|
166
|
+
continue
|
|
167
|
+
assert False, f"No rid found for a pharmacogenomic with {gene}"
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@pytest.mark.skipif(
|
|
171
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (requires CGL loader))"
|
|
172
|
+
)
|
|
173
|
+
def test_get_gene_linked_pharmacogenomic_info(conn):
|
|
174
|
+
genes, matches = get_gene_linked_pharmacogenomic_info(conn)
|
|
175
|
+
for gene in PHARMACOGENOMIC_INITIAL_GENES:
|
|
176
|
+
assert gene in genes, f"{gene} not found in get_pharmacogenomic_info"
|
|
177
|
+
for rid, variant_info in matches.items():
|
|
178
|
+
variant_gene_assoc = variant_info[1]
|
|
179
|
+
if gene in variant_gene_assoc:
|
|
180
|
+
break
|
|
181
|
+
else: # no break called
|
|
182
|
+
assert False, f"No rid found for a pharmacogenomic with {gene}"
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
186
|
+
@pytest.mark.skipif(
|
|
187
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (requires CGL loader))"
|
|
188
|
+
)
|
|
189
|
+
def test_get_cancer_predisposition_info(conn):
|
|
190
|
+
genes, matches = get_cancer_predisposition_info(conn)
|
|
191
|
+
for gene in CANCER_PREDISP_INITIAL_GENES:
|
|
192
|
+
assert gene in genes, f"{gene} not found in get_cancer_predisposition_info"
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
196
|
+
@pytest.mark.skipif(
|
|
197
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (requires CGL loader))"
|
|
198
|
+
)
|
|
199
|
+
def test_get_gene_linked_cancer_predisposition_info(conn):
|
|
200
|
+
genes, matches = get_gene_linked_cancer_predisposition_info(conn)
|
|
201
|
+
for gene in CANCER_PREDISP_INITIAL_GENES:
|
|
202
|
+
assert gene in genes, f"{gene} not found in get_cancer_predisposition_info"
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@pytest.mark.parametrize(
|
|
206
|
+
"alt_rep", ("NM_033360.4", "NM_033360", "ENSG00000133703.11", "ENSG00000133703")
|
|
207
|
+
)
|
|
208
|
+
def test_get_preferred_gene_name_kras(alt_rep, conn):
|
|
209
|
+
gene_name = get_preferred_gene_name(conn, alt_rep)
|
|
210
|
+
assert (
|
|
211
|
+
"KRAS" == gene_name
|
|
212
|
+
), f"Expected KRAS as preferred gene name for {alt_rep}, not '{gene_name}'"
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@pytest.mark.skipif(
|
|
216
|
+
EXCLUDE_BCGSC_TESTS, reason="excluding BCGSC-specific tests (requires CGL loader))"
|
|
217
|
+
)
|
|
218
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
219
|
+
def test_find_genes_by_variant_type_structural_variant(conn):
|
|
220
|
+
result = get_genes_from_variant_types(conn, ["structural variant"])
|
|
221
|
+
names = {row["name"] for row in result}
|
|
222
|
+
for gene in CANONICAL_STRUCTURAL_VARIANT_GENES:
|
|
223
|
+
assert gene in names, f"{gene} was not identified as a structural variant gene."
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
227
|
+
def test_find_no_genes_by_variant_type_with_nonmatching_source_record_id(conn):
|
|
228
|
+
refseq_id = get_rid(conn, target="source", name="refseq")
|
|
229
|
+
result = get_genes_from_variant_types(
|
|
230
|
+
conn, ["structural variant"], source_record_ids=[refseq_id]
|
|
231
|
+
)
|
|
232
|
+
assert not result
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
236
|
+
def test_get_therapeutic_associated_genes(conn):
|
|
237
|
+
gene_list = get_therapeutic_associated_genes(graphkb_conn=conn)
|
|
238
|
+
assert gene_list, "No get_therapeutic_associated_genes found"
|
|
239
|
+
assert (
|
|
240
|
+
len(gene_list) > 300
|
|
241
|
+
), f"Expected over 300 get_therapeutic_associated_genes but found {len(gene_list)}"
|
|
242
|
+
names = {row["name"] for row in gene_list}
|
|
243
|
+
for gene in CANNONICAL_THERAPY_GENES + CANONICAL_ONCOGENES + CANONICAL_TS:
|
|
244
|
+
assert gene in names, f"{gene} not found by get_therapeutic_associated_genes"
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@pytest.mark.skipif(
|
|
248
|
+
EXCLUDE_BCGSC_TESTS,
|
|
249
|
+
reason="excluding BCGSC-specific tests (requires oncokb and other loaders))",
|
|
250
|
+
)
|
|
251
|
+
@pytest.mark.skipif(EXCLUDE_INTEGRATION_TESTS, reason="excluding long running integration tests")
|
|
252
|
+
def test_get_gene_information(conn):
|
|
253
|
+
gene_info = get_gene_information(
|
|
254
|
+
conn,
|
|
255
|
+
CANONICAL_ONCOGENES
|
|
256
|
+
+ CANONICAL_TS
|
|
257
|
+
+ CANONICAL_CG
|
|
258
|
+
+ CANONICAL_FUSION_GENES
|
|
259
|
+
+ CANONICAL_STRUCTURAL_VARIANT_GENES
|
|
260
|
+
+ CANNONICAL_THERAPY_GENES
|
|
261
|
+
+ ["notagenename"],
|
|
262
|
+
)
|
|
263
|
+
assert gene_info
|
|
264
|
+
nongene_flagged = [g["name"] for g in gene_info if g["name"] == "notagenename"]
|
|
265
|
+
assert not nongene_flagged, f"Improper gene category: {nongene_flagged}"
|
|
266
|
+
|
|
267
|
+
for gene in CANONICAL_ONCOGENES:
|
|
268
|
+
assert gene in [
|
|
269
|
+
g["name"] for g in gene_info if g.get("oncogene")
|
|
270
|
+
], f"Missed oncogene {gene}"
|
|
271
|
+
|
|
272
|
+
for gene in CANONICAL_TS:
|
|
273
|
+
assert gene in [
|
|
274
|
+
g["name"] for g in gene_info if g.get("tumourSuppressor")
|
|
275
|
+
], f"Missed 'tumourSuppressor' {gene}"
|
|
276
|
+
|
|
277
|
+
for gene in CANONICAL_FUSION_GENES:
|
|
278
|
+
assert gene in [
|
|
279
|
+
g["name"] for g in gene_info if g.get("knownFusionPartner")
|
|
280
|
+
], f"Missed knownFusionPartner {gene}"
|
|
281
|
+
|
|
282
|
+
for gene in CANONICAL_STRUCTURAL_VARIANT_GENES:
|
|
283
|
+
assert gene in [
|
|
284
|
+
g["name"] for g in gene_info if g.get("knownSmallMutation")
|
|
285
|
+
], f"Missed knownSmallMutation {gene}"
|
|
286
|
+
|
|
287
|
+
for gene in CANNONICAL_THERAPY_GENES:
|
|
288
|
+
assert gene in [
|
|
289
|
+
g["name"] for g in gene_info if g.get("therapeuticAssociated")
|
|
290
|
+
], f"Missed therapeuticAssociated {gene}"
|
|
291
|
+
|
|
292
|
+
for gene in (
|
|
293
|
+
CANONICAL_ONCOGENES
|
|
294
|
+
+ CANONICAL_TS
|
|
295
|
+
+ CANONICAL_FUSION_GENES
|
|
296
|
+
+ CANONICAL_STRUCTURAL_VARIANT_GENES
|
|
297
|
+
+ CANNONICAL_THERAPY_GENES
|
|
298
|
+
):
|
|
299
|
+
assert gene in [
|
|
300
|
+
g["name"] for g in gene_info if g.get("kbStatementRelated")
|
|
301
|
+
], f"Missed kbStatementRelated {gene}"
|
|
302
|
+
|
|
303
|
+
for gene in CANONICAL_CG:
|
|
304
|
+
assert gene in [
|
|
305
|
+
g["name"] for g in gene_info if g.get("cancerGeneListMatch")
|
|
306
|
+
], f"Missed cancerGeneListMatch {gene}"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import pytest
|
|
3
|
+
from unittest import mock
|
|
4
|
+
|
|
5
|
+
from pori_python.graphkb import GraphKBConnection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_login_ok():
|
|
9
|
+
conn = GraphKBConnection()
|
|
10
|
+
conn.login(os.environ["GRAPHKB_USER"], os.environ["GRAPHKB_PASS"])
|
|
11
|
+
assert conn.token is not None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture(scope="module")
|
|
15
|
+
def conn():
|
|
16
|
+
conn = GraphKBConnection()
|
|
17
|
+
conn.login(os.environ["GRAPHKB_USER"], os.environ["GRAPHKB_PASS"])
|
|
18
|
+
return conn
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TestPaginate:
|
|
22
|
+
@mock.patch("pori_python.graphkb.GraphKBConnection.request")
|
|
23
|
+
def test_does_not_paginate_when_false(self, graphkb_request, conn):
|
|
24
|
+
graphkb_request.side_effect = [{"result": [1, 2, 3]}, {"result": [4, 5]}]
|
|
25
|
+
result = conn.query({}, paginate=False, limit=3)
|
|
26
|
+
assert result == [1, 2, 3]
|
|
27
|
+
|
|
28
|
+
@mock.patch("pori_python.graphkb.GraphKBConnection.request")
|
|
29
|
+
def test_paginates_by_default(self, graphkb_request, conn):
|
|
30
|
+
graphkb_request.side_effect = [{"result": [1, 2, 3]}, {"result": [4, 5]}]
|
|
31
|
+
result = conn.query({}, paginate=True, limit=3)
|
|
32
|
+
assert result == [1, 2, 3, 4, 5]
|