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.
Files changed (49) hide show
  1. pori_python/__init__.py +1 -0
  2. pori_python/graphkb/__init__.py +2 -0
  3. pori_python/graphkb/constants.py +220 -0
  4. pori_python/graphkb/genes.py +540 -0
  5. pori_python/graphkb/match.py +710 -0
  6. pori_python/graphkb/py.typed +0 -0
  7. pori_python/graphkb/statement.py +48 -0
  8. pori_python/graphkb/util.py +523 -0
  9. pori_python/graphkb/vocab.py +198 -0
  10. pori_python/ipr/__init__.py +0 -0
  11. pori_python/ipr/annotate.py +373 -0
  12. pori_python/ipr/connection.py +214 -0
  13. pori_python/ipr/constants.py +9 -0
  14. pori_python/ipr/inputs.py +593 -0
  15. pori_python/ipr/ipr.py +390 -0
  16. pori_python/ipr/main.py +512 -0
  17. pori_python/ipr/py.typed +0 -0
  18. pori_python/ipr/summary.py +412 -0
  19. pori_python/ipr/therapeutic_options.py +83 -0
  20. pori_python/ipr/util.py +173 -0
  21. pori_python/types.py +177 -0
  22. pori_python-0.1.0.dist-info/LICENSE +674 -0
  23. pori_python-0.1.0.dist-info/METADATA +151 -0
  24. pori_python-0.1.0.dist-info/RECORD +49 -0
  25. pori_python-0.1.0.dist-info/WHEEL +5 -0
  26. pori_python-0.1.0.dist-info/dependency_links.txt +1 -0
  27. pori_python-0.1.0.dist-info/entry_points.txt +2 -0
  28. pori_python-0.1.0.dist-info/top_level.txt +2 -0
  29. tests/__init__.py +0 -0
  30. tests/test_graphkb/__init__.py +0 -0
  31. tests/test_graphkb/data.py +78 -0
  32. tests/test_graphkb/test_genes.py +306 -0
  33. tests/test_graphkb/test_graphkb.py +32 -0
  34. tests/test_graphkb/test_match.py +662 -0
  35. tests/test_graphkb/test_statement.py +100 -0
  36. tests/test_graphkb/test_util.py +151 -0
  37. tests/test_graphkb/test_vocab.py +85 -0
  38. tests/test_ipr/__init__.py +0 -0
  39. tests/test_ipr/constants.py +3 -0
  40. tests/test_ipr/test_annotate.py +149 -0
  41. tests/test_ipr/test_connection.py +97 -0
  42. tests/test_ipr/test_inputs.py +295 -0
  43. tests/test_ipr/test_ipr.py +338 -0
  44. tests/test_ipr/test_main.py +154 -0
  45. tests/test_ipr/test_probe.py +72 -0
  46. tests/test_ipr/test_summary.py +157 -0
  47. tests/test_ipr/test_upload.py +274 -0
  48. tests/test_ipr/test_util.py +29 -0
  49. tests/test_ipr/util.py +9 -0
@@ -0,0 +1 @@
1
+ from . import graphkb, ipr # noqa: F401
@@ -0,0 +1,2 @@
1
+ from .constants import DEFAULT_URL # noqa: F401
2
+ from .util import GraphKBConnection, logger # noqa: F401
@@ -0,0 +1,220 @@
1
+ import argparse
2
+ from typing import Dict
3
+
4
+ from pori_python.types import CategoryBaseTermMapping
5
+
6
+ DEFAULT_LIMIT = 1000
7
+ GKB_BASE_URL = "https://graphkb-api.bcgsc.ca/api"
8
+ GKB_STAGING_URL = "https://graphkbstaging-api.bcgsc.ca/api"
9
+ GKB_DEV_URL = "https://graphkbdev-api.bcgsc.ca/api"
10
+ DEFAULT_URL = GKB_BASE_URL
11
+
12
+ PREFERRED_GENE_SOURCE = "#39:5" # HGNC
13
+ PREFERRED_GENE_SOURCE_NAME = "HGNC"
14
+
15
+ BASE_RETURN_PROPERTIES = ["@rid", "@class"]
16
+
17
+ GENERIC_RETURN_PROPERTIES = [
18
+ "name",
19
+ "sourceId",
20
+ "sourceIdVersion",
21
+ "source.name",
22
+ "source.@rid",
23
+ "displayName",
24
+ "deprecated",
25
+ ] + BASE_RETURN_PROPERTIES
26
+
27
+ GENE_RETURN_PROPERTIES = ["biotype"] + GENERIC_RETURN_PROPERTIES
28
+
29
+ VARIANT_RETURN_PROPERTIES = (
30
+ BASE_RETURN_PROPERTIES
31
+ + [f"type.{p}" for p in GENERIC_RETURN_PROPERTIES]
32
+ + [f"reference1.{p}" for p in GENE_RETURN_PROPERTIES]
33
+ + [f"reference2.{p}" for p in GENE_RETURN_PROPERTIES]
34
+ + ["zygosity", "germline", "displayName"]
35
+ )
36
+
37
+ POS_VARIANT_RETURN_PROPERTIES = VARIANT_RETURN_PROPERTIES + [
38
+ "break1Start",
39
+ "break1End",
40
+ "break2Start",
41
+ "break2End",
42
+ "break1Repr",
43
+ "break2Repr",
44
+ "refSeq",
45
+ "untemplatedSeq",
46
+ "untemplatedSeqSize",
47
+ "truncation",
48
+ "assembly",
49
+ ]
50
+
51
+ STATEMENT_RETURN_PROPERTIES = (
52
+ BASE_RETURN_PROPERTIES
53
+ + ["displayNameTemplate", "sourceId", "source.name", "source.displayName"]
54
+ + [f"conditions.{p}" for p in GENERIC_RETURN_PROPERTIES]
55
+ + [f"subject.{p}" for p in GENERIC_RETURN_PROPERTIES]
56
+ + [f"evidence.{p}" for p in GENERIC_RETURN_PROPERTIES]
57
+ + [f"relevance.{p}" for p in GENERIC_RETURN_PROPERTIES]
58
+ + [f"evidenceLevel.{p}" for p in GENERIC_RETURN_PROPERTIES]
59
+ + ["reviewStatus"]
60
+ )
61
+
62
+
63
+ ONCOKB_SOURCE_NAME = "oncokb"
64
+ TSO500_SOURCE_NAME = "tso500"
65
+ ONCOGENE = "oncogenic"
66
+ TUMOUR_SUPPRESSIVE = "tumour suppressive"
67
+ CANCER_GENE = "cancer gene"
68
+ FUSION_NAMES = ["structural variant", "fusion"]
69
+
70
+ GSC_PHARMACOGENOMIC_SOURCE_EXCLUDE_LIST = ["cancer genome interpreter", "civic"]
71
+ GSC_PHARMACOGENOMIC_SOURCE_DISPLAYNAME_EXCLUDE_LIST = ["CGI", "CIViC"]
72
+
73
+ BASE_THERAPEUTIC_TERMS = ["therapeutic efficacy", "eligibility"]
74
+ # the order here is the order these are applied, the first category matched is returned
75
+ RELEVANCE_BASE_TERMS: CategoryBaseTermMapping = [
76
+ ("therapeutic", BASE_THERAPEUTIC_TERMS),
77
+ ("diagnostic", ["diagnostic indicator"]),
78
+ ("prognostic", ["prognostic indicator"]),
79
+ ("pharmacogenomic", ["metabolism", "toxicity", "dosage"]),
80
+ ("cancer predisposition", ["pathogenic"]),
81
+ ("biological", ["functional effect", "tumourigenesis", "predisposing"]),
82
+ ]
83
+ FAILED_REVIEW_STATUS = "failed"
84
+
85
+ CHROMOSOMES_HG38 = [f"chr{i}" for i in range(1, 23)] + ["chrX", "chrY", "chrM"]
86
+ CHROMOSOMES_HG19 = [str(i) for i in range(1, 23)] + ["x", "y", "mt"]
87
+ CHROMOSOMES = CHROMOSOMES_HG38 + CHROMOSOMES_HG19
88
+
89
+ AMBIGUOUS_AA = ["x", "?", "X"]
90
+ AA_3to1_MAPPING = {
91
+ "Ala": "A",
92
+ "Arg": "R",
93
+ "Asn": "N",
94
+ "Asp": "D",
95
+ "Asx": "B",
96
+ "Cys": "C",
97
+ "Glu": "E",
98
+ "Gln": "Q",
99
+ "Glx": "Z",
100
+ "Gly": "G",
101
+ "His": "H",
102
+ "Ile": "I",
103
+ "Leu": "L",
104
+ "Lys": "K",
105
+ "Met": "M",
106
+ "Phe": "F",
107
+ "Pro": "P",
108
+ "Ser": "S",
109
+ "Thr": "T",
110
+ "Trp": "W",
111
+ "Tyr": "Y",
112
+ "Val": "V",
113
+ "Ter": "*",
114
+ }
115
+
116
+
117
+ class IterableNamespace(argparse.Namespace):
118
+ def __init__(self, *pos, **kwargs):
119
+ argparse.Namespace.__init__(self, *pos, **kwargs)
120
+
121
+ def keys(self):
122
+ return self.__dict__.keys()
123
+
124
+ def items(self):
125
+ return self.__dict__.items()
126
+
127
+ def values(self):
128
+ return self.__dict__.values()
129
+
130
+ def __getitem__(self, key):
131
+ return getattr(self, key)
132
+
133
+
134
+ INPUT_COPY_CATEGORIES = IterableNamespace(
135
+ AMP="amplification",
136
+ ANY_GAIN="copy gain",
137
+ ANY_LOSS="copy loss",
138
+ DEEP="deep deletion",
139
+ GAIN="low level copy gain",
140
+ LOSS="shallow deletion",
141
+ )
142
+ INPUT_EXPRESSION_CATEGORIES = IterableNamespace(
143
+ UP="increased expression", DOWN="reduced expression"
144
+ )
145
+
146
+ # From: https://github.com/bcgsc/pori_graphkb_parser/blob/ae3738842a4c208ab30f58c08ae987594d632504/src/constants.ts#L33-L80
147
+ TYPES_TO_NOTATION: Dict[str, str] = {
148
+ "acetylation": "ac",
149
+ "copy gain": "copygain",
150
+ "copy loss": "copyloss",
151
+ "deletion": "del",
152
+ "duplication": "dup",
153
+ "extension": "ext",
154
+ "frameshift": "fs",
155
+ "fusion": "fusion",
156
+ "indel": "delins",
157
+ "insertion": "ins",
158
+ "inversion": "inv",
159
+ "inverted translocation": "itrans",
160
+ "methylation": "me",
161
+ "missense mutation": "mis",
162
+ "mutation": "mut",
163
+ "nonsense mutation": ">",
164
+ "phosphorylation": "phos",
165
+ "splice-site": "spl",
166
+ "substitution": ">",
167
+ "translocation": "trans",
168
+ "truncating frameshift mutation": "fs",
169
+ "ubiquitination": "ub",
170
+ # deprecated forms and aliases
171
+ "frameshift mutation": "fs",
172
+ "frameshift truncation": "fs",
173
+ "missense variant": "mis",
174
+ "truncating frameshift": "fs",
175
+ "missense": "mis",
176
+ "mutations": "mut",
177
+ "nonsense": ">",
178
+ }
179
+
180
+ # For match.type_screening() [KBDEV-1056]
181
+ DEFAULT_NON_STRUCTURAL_VARIANT_TYPE = "mutation"
182
+ STRUCTURAL_VARIANT_SIZE_THRESHOLD = 48 # bp
183
+ STRUCTURAL_VARIANT_TYPES = [
184
+ "structural variant",
185
+ "insertion",
186
+ "in-frame insertion",
187
+ "deletion",
188
+ "deletion polymorphism",
189
+ "in-frame deletion",
190
+ "translocation",
191
+ "inverted translocation",
192
+ "inversion",
193
+ "indel",
194
+ "fusion",
195
+ "out-of-frame fusion",
196
+ "oncogenic fusion",
197
+ "in-frame fusion",
198
+ "disruptive fusion",
199
+ "duplication",
200
+ "internal duplication",
201
+ "tandem duplication",
202
+ "internal tandem duplication",
203
+ "itd",
204
+ "domain duplication",
205
+ "kinase domain duplication",
206
+ "copy variant",
207
+ "copy number variation",
208
+ "copy number variant",
209
+ "copy loss",
210
+ "copy number loss",
211
+ "shallow deletion",
212
+ "deep deletion",
213
+ "gene deletion",
214
+ "copy gain",
215
+ "copy number gain",
216
+ "low level copy gain",
217
+ "amplification",
218
+ "focal amplification",
219
+ "rearrangement",
220
+ ]