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
pori_python/types.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Optional, Tuple, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
# TODO: Can constants in inputs.py like COPY_REQ, SMALL_MUT_REQ, just be replaced by types?
|
|
6
|
+
|
|
7
|
+
CategoryBaseTermMapping = List[Tuple[str, List[str]]]
|
|
8
|
+
Record = TypedDict("Record", {"@rid": str, "@class": str, "name": str})
|
|
9
|
+
EmbeddedRecord = TypedDict("EmbeddedRecord", {"@class": str})
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DisplayedRecord(Record):
|
|
13
|
+
displayName: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Ontology(DisplayedRecord):
|
|
17
|
+
sourceId: str
|
|
18
|
+
sourceIdVersion: Optional[str]
|
|
19
|
+
source: Record
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class BasicPosition(EmbeddedRecord):
|
|
23
|
+
pos: int
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CytobandPosition(EmbeddedRecord):
|
|
27
|
+
arm: str
|
|
28
|
+
majorBand: str
|
|
29
|
+
minorBand: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Position = Union[BasicPosition, CytobandPosition]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Variant(Record):
|
|
36
|
+
reference1: Ontology
|
|
37
|
+
reference2: Optional[Ontology]
|
|
38
|
+
type: str
|
|
39
|
+
zygosity: str
|
|
40
|
+
germline: bool
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ParsedVariant(Variant):
|
|
44
|
+
break1Start: Union[Position, CytobandPosition]
|
|
45
|
+
break1End: Optional[Union[Position, CytobandPosition]]
|
|
46
|
+
break2Start: Optional[Union[Position, CytobandPosition]]
|
|
47
|
+
break2End: Optional[Union[Position, CytobandPosition]]
|
|
48
|
+
refSeq: Optional[str]
|
|
49
|
+
untemplatedSeq: Optional[str]
|
|
50
|
+
untemplatedSeqSize: Optional[int]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class PositionalVariant(ParsedVariant):
|
|
54
|
+
displayName: str
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Statement(Record):
|
|
58
|
+
relevance: Ontology
|
|
59
|
+
subject: Ontology
|
|
60
|
+
conditions: List[Ontology]
|
|
61
|
+
evidence: List[Ontology]
|
|
62
|
+
evidenceLevel: List[Ontology]
|
|
63
|
+
source: Record
|
|
64
|
+
sourceId: str
|
|
65
|
+
reviewStatus: str
|
|
66
|
+
displayNameTemplate: str
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class KbMatch(TypedDict):
|
|
70
|
+
variant: str
|
|
71
|
+
variantType: str
|
|
72
|
+
approvedTherapy: bool
|
|
73
|
+
category: str
|
|
74
|
+
context: str
|
|
75
|
+
kbContextId: str
|
|
76
|
+
disease: str
|
|
77
|
+
evidenceLevel: str
|
|
78
|
+
iprEvidenceLevel: Optional[str]
|
|
79
|
+
kbStatementId: str
|
|
80
|
+
kbVariant: str
|
|
81
|
+
kbVariantId: str
|
|
82
|
+
matchedCancer: bool
|
|
83
|
+
reference: str
|
|
84
|
+
relevance: str
|
|
85
|
+
kbRelevanceId: str
|
|
86
|
+
externalSource: str
|
|
87
|
+
externalStatementId: str
|
|
88
|
+
reviewStatus: str
|
|
89
|
+
kbData: Dict
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class Hashabledict(dict):
|
|
93
|
+
def __hash__(self):
|
|
94
|
+
return hash(frozenset(self))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class IprVariantBase(TypedDict):
|
|
98
|
+
"""Required properties of all variants for IPR."""
|
|
99
|
+
|
|
100
|
+
key: str
|
|
101
|
+
variantType: str
|
|
102
|
+
variant: str
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class IprGeneVariant(IprVariantBase):
|
|
106
|
+
gene: str
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class IprGene(TypedDict):
|
|
110
|
+
name: str
|
|
111
|
+
kbStatementRelated: Optional[bool]
|
|
112
|
+
knownFusionPartner: Optional[bool]
|
|
113
|
+
knownSmallMutation: Optional[bool]
|
|
114
|
+
tumourSuppressor: Optional[bool]
|
|
115
|
+
oncogene: Optional[bool]
|
|
116
|
+
therapeuticAssociated: Optional[bool]
|
|
117
|
+
cancerGeneListMatch: Optional[bool]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class IprCopyVariant(IprGeneVariant):
|
|
121
|
+
# variantType == 'cnv'
|
|
122
|
+
kbCategory: str
|
|
123
|
+
cnvState: str
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class IprExprVariant(IprGeneVariant):
|
|
127
|
+
# variantType == 'exp'
|
|
128
|
+
kbCategory: str
|
|
129
|
+
expressionState: str
|
|
130
|
+
histogramImage: Optional[str]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class IprStructVarBase(IprVariantBase):
|
|
134
|
+
"""One of the hgvs notations or proteinChange is required."""
|
|
135
|
+
|
|
136
|
+
hgvsProtein: Optional[str]
|
|
137
|
+
hgvsCds: Optional[str]
|
|
138
|
+
hgvsGenomic: Optional[str]
|
|
139
|
+
proteinChange: Optional[str] # Older - being deprecated
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class IprSmallMutationVariant(IprStructVarBase):
|
|
143
|
+
"""SNPs and small INDELs"""
|
|
144
|
+
|
|
145
|
+
# variantType == 'mut'
|
|
146
|
+
gene: str # equivalent of gene1 in IprFusionVariant
|
|
147
|
+
germline: Optional[bool]
|
|
148
|
+
startPosition: Optional[int]
|
|
149
|
+
endPosition: Optional[int] # Must equal startPosition for SNPs
|
|
150
|
+
normalAltCount: Optional[int]
|
|
151
|
+
normalDepth: Optional[int]
|
|
152
|
+
normalRefCount: Optional[int]
|
|
153
|
+
rnaAltCount: Optional[int]
|
|
154
|
+
rnaDepth: Optional[int]
|
|
155
|
+
rnaRefCount: Optional[int]
|
|
156
|
+
tumourAltCount: Optional[int]
|
|
157
|
+
tumourDepth: Optional[int]
|
|
158
|
+
tumourRefCount: Optional[int]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class IprFusionVariant(IprStructVarBase):
|
|
162
|
+
# variantType = 'sv
|
|
163
|
+
gene1: str
|
|
164
|
+
gene2: str
|
|
165
|
+
exon1: int
|
|
166
|
+
exon2: int
|
|
167
|
+
highQuality: Optional[bool] # high quality event found by multiple tools.
|
|
168
|
+
svg: Optional[str] # path to svg image of fusion
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class ImageDefinition(TypedDict):
|
|
172
|
+
key: str
|
|
173
|
+
path: str
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
IprStructuralVariant = Union[IprSmallMutationVariant, IprFusionVariant]
|
|
177
|
+
IprVariant = Union[IprCopyVariant, IprExprVariant, IprStructuralVariant]
|