|
1 |
| -from typing import Dict, List, Optional, Union |
| 1 | +from typing import Dict, List, Optional, Tuple, TypedDict, Union |
2 | 2 |
|
3 |
| -try: |
4 |
| - from typing import TypedDict # type: ignore |
5 |
| -except ImportError: |
6 |
| - from typing_extensions import TypedDict |
| 3 | +# TODO: Can constants in inputs.py like COPY_REQ, SMALL_MUT_REQ, just be replaced by types? |
7 | 4 |
|
8 |
| -from pori_python.graphkb.types import Ontology, Record |
| 5 | +CategoryBaseTermMapping = List[Tuple[str, List[str]]] |
| 6 | +Record = TypedDict("Record", {"@rid": str, "@class": str}) |
| 7 | +EmbeddedRecord = TypedDict("EmbeddedRecord", {"@class": str}) |
| 8 | +RecordLink = Union[str, Record] |
9 | 9 |
|
10 |
| -# TODO: Can constants in inputs.py like COPY_REQ, SMALL_MUT_REQ, just be replaced by types? |
| 10 | + |
| 11 | +class Ontology(Record): |
| 12 | + sourceId: str |
| 13 | + name: str |
| 14 | + source: RecordLink |
| 15 | + displayName: str |
| 16 | + |
| 17 | + |
| 18 | +class OntologyTerm(Record): |
| 19 | + name: Optional[str] |
| 20 | + sourceId: Optional[str] |
| 21 | + sourceIdVersion: Optional[str] |
| 22 | + displayName: Optional[str] |
| 23 | + |
| 24 | + |
| 25 | +OntologyLink = Union[str, Ontology] |
| 26 | + |
| 27 | + |
| 28 | +class BasicPosition(EmbeddedRecord): |
| 29 | + pos: int |
| 30 | + |
| 31 | + |
| 32 | +class CytobandPosition(EmbeddedRecord): |
| 33 | + arm: str |
| 34 | + majorBand: str |
| 35 | + minorBand: str |
| 36 | + |
| 37 | + |
| 38 | +Position = Union[BasicPosition, CytobandPosition] |
| 39 | + |
| 40 | + |
| 41 | +class Variant(Record): |
| 42 | + reference1: OntologyLink |
| 43 | + reference2: Optional[OntologyLink] |
| 44 | + type: OntologyLink |
| 45 | + zygosity: str |
| 46 | + germline: bool |
| 47 | + displayName: str |
| 48 | + |
| 49 | + |
| 50 | +class PositionalVariant(Variant): |
| 51 | + break1Start: Union[Position, CytobandPosition] |
| 52 | + break1End: Optional[Union[Position, CytobandPosition]] |
| 53 | + break2Start: Optional[Union[Position, CytobandPosition]] |
| 54 | + break2End: Optional[Union[Position, CytobandPosition]] |
| 55 | + refSeq: Optional[str] |
| 56 | + untemplatedSeq: Optional[str] |
| 57 | + untemplatedSeqSize: Optional[int] |
| 58 | + |
| 59 | + |
| 60 | +class ParsedVariant(TypedDict): |
| 61 | + reference1: str |
| 62 | + reference2: Optional[str] |
| 63 | + type: str |
| 64 | + zygosity: str |
| 65 | + germline: bool |
| 66 | + break1Start: Union[Position, CytobandPosition] |
| 67 | + break1End: Optional[Union[Position, CytobandPosition]] |
| 68 | + break2Start: Optional[Union[Position, CytobandPosition]] |
| 69 | + break2End: Optional[Union[Position, CytobandPosition]] |
| 70 | + refSeq: Optional[str] |
| 71 | + untemplatedSeq: Optional[str] |
| 72 | + untemplatedSeqSize: Optional[int] |
| 73 | + |
| 74 | + |
| 75 | +class Statement(Record): |
| 76 | + relevance: OntologyLink |
| 77 | + subject: OntologyLink |
| 78 | + conditions: List[OntologyLink] |
| 79 | + evidence: List[OntologyLink] |
| 80 | + evidenceLevel: List[OntologyLink] |
| 81 | + source: RecordLink |
| 82 | + sourceId: str |
11 | 83 |
|
12 | 84 |
|
13 | 85 | class KbMatch(TypedDict):
|
|
0 commit comments