-
Notifications
You must be signed in to change notification settings - Fork 1
/
sub_payload.py
384 lines (301 loc) · 11.2 KB
/
sub_payload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
"""Data structures for encoding the submission payload."""
from enum import Enum
import typing
import attrs
class Assembly(Enum):
GRCH38 = "GRCh38"
HG38 = "hg38"
GRCH37 = "GRCh37"
HG19 = "hg19"
NCBI36 = "NCBI36"
HG18 = "hg18"
class Chromosome(Enum):
CHR1 = "1"
CHR2 = "2"
CHR3 = "3"
CHR4 = "4"
CHR5 = "5"
CHR6 = "6"
CHR7 = "7"
CHR8 = "8"
CHR9 = "9"
CHR10 = "10"
CHR11 = "11"
CHR12 = "12"
CHR13 = "13"
CHR14 = "14"
CHR15 = "15"
CHR16 = "16"
CHR17 = "17"
CHR18 = "18"
CHR19 = "19"
CHR20 = "20"
CHR21 = "21"
CHR22 = "22"
CHRX = "X"
CHRY = "Y"
CHRMT = "MT"
class VariantType(Enum):
INSERTION = "Insertion"
DELETION = "Deletion"
DUPLICATION = "Duplication"
TANDEM_DUPLICATIOn = "Tandem duplication"
COPY_NUMBER_LOSS = "copy number loss"
COPY_NUMBER_GAIN = "copy number gain"
INVERSION = "Inversion"
TRANSLOCATION = "Translocation"
COMPLEX = "Complex"
class CitationDb(Enum):
"""Allowed values for a citation's `db` field.
The values of the enumeration map to the values used by the ClinVar submission API.
"""
PUBMED = "PubMed"
BOOKSHELF = "BookShelf"
DOI = "DOI"
PMC = "pmc"
class ConditionDb(Enum):
OMIM = "OMIM"
MEDGEN = "MedGen"
ORPHANET = "Orphanet"
MESH = "MeSH"
HP = "HP"
MONDO = "MONDO"
class AffectedStatus(Enum):
YES = "yes"
NO = "no"
UNKNOWN = "unknown"
NOT_PROVIDED = "not provided"
NOT_APPLICABLE = "not applicable"
class AlleleOrigin(Enum):
GERMLINE = "germline"
SOMATIC = "somatic"
DE_NOVO = "de novo"
UNKNOWN = "unknown"
INHERITED = "inherited"
MATERNAL = "maternal"
PATERNAL = "paternal"
BIPARENTL = "biparental"
NOT_APPLICABLE = "not applicable"
class ClinicalFeaturesAffectedStatus(Enum):
PRESENT = "present"
ABSENT = "absent"
NOT_TESTED = "not tested"
class ClinicalFeaturesDb(Enum):
HP = "HP"
class CollectionMethod(Enum):
CURATION = "curation"
LITERATURE_ONLY = "literature only"
REFERENCE_POPULATION = "reference population"
PROVIDER_INTERPRETATION = "provider interpretation"
PHENOTYPING_ONLY = "phenotyping only"
CASE_CONTROL = "case-control"
CLINICAL_TESTING = "clinical testing"
IN_VITRO = "in vitro"
IN_VIVO = "in vivo"
RESEARCH = "research"
NOT_PROVIDED = "not provided"
class StructVarMethodType(Enum):
SNP_ARRAY = "SNP array"
OLIGO_ARRAY = "Oligo array"
READ_DEPTH = "Read depth"
PAIRED_END_MAPPING = "Paired-end mapping"
ONE_END_ANCHORED_ASSEMBLY = "One end anchored assembly"
SEQUENCE_ALIGNMENT = "Sequence alignment"
OPTICAL_MAPPING = "Optical mapping"
CURATED_PCR = "Curated,PCR"
class ClinicalSignificanceDescription(Enum):
"""Allowed values for the ``clinicalSignificanceDescription``.
The values of the enumeration map to the values used by the ClinVar submission API.
"""
PATHOGENIC = "Pathogenic"
LIKELY_PATHOGENIC = "Likely pathogenic"
UNCERTAIN_SIGNIFICANCE = "Uncertain significance"
LIKELY_BENIGN = "Likely benign"
BENIGN = "Benign"
PATHOGENIC_LOW_PENETRANCE = "Pathogenic, low penetrance"
UNCERTAIN_RISK_ALLELE = "Uncertain risk allele"
LIKELY_PATHOGENIC_LOW_PENETRANCE = "Likely pathogenic, low penetrance"
ESTABLISHED_RISK_ALLELE = "Established risk allele"
LIKELY_RISK_ALLELE = "Likely risk allele"
AFFECTED = "affects"
ASSOCIATION = "association"
DRUG_RESPONSE = "drug response"
CONFERS_SENSITIVITY = "confers sensitivity"
PROTECTIVE = "protective"
OTHER = "other"
NOT_PROVIDED = "not provided"
class ModeOfInheritance(Enum):
AUTOSOMAL_DOMINANT_INHERITANCE = "Autosomal dominant inheritance"
AUTOSOMAL_RECESSIVE_INHERITANCE = "Autosomal recessive inheritance"
MITOCHONDRIAL_INHERITANCE = "Mitochondrial inheritance"
SOMATIC_MUTATION = "Somatic mutation"
GENETIC_ANTICIPATION = "Genetic anticipation"
SPORADIC = "Sporadic"
SEX_LIMITED_AUTOSOMAL_DOMINANT = "Sex-limited autosomal dominant"
X_LINKED_RECESSIVE_INHERITANCE = "X-linked recessive inheritance"
X_LINKED_DOMINANT_INHERITANCE = "X-linked dominant inheritance"
Y_LINKED_INHERITANCE = "Y-linked inheritance"
OTHER = "Other"
X_LINKED_INHERITANCE = "X-linked inheritance"
CODOMINANT = "Codominant"
DEMIDOMINANT_INHERITANCE = "Semidominant inheritance"
AUTOSOMAL_UNKNOWN = "Autosomal unknown"
AUTOSOMAL_DOMINANT_INHERITANCE_WITH_MATERNAL_IMPRINTING = (
"Autosomal dominant inheritance with maternal imprinting"
)
AUTOSOMAL_DOMINANT_INHERITANCE_WITH_PATERNAL_IMPRINTING = (
"Autosomal dominant inheritance with paternal imprinting"
)
MULTIFACTORIAL_INHERITANCE = "Multifactorial inheritance"
UNKNOWN_MECHANISM = "Unknown mechanism"
OLIGOGENIC_INHERITANCE = "Oligogenic inheritance"
class RecordStatus(Enum):
NOVEL = "novel"
UPDATE = "update"
class ReleaseStatus(Enum):
PUBLIC = "public"
HOLD_UNTIL_PUBLISHED = "hold until published"
@attrs.define(frozen=True)
class SubmissionClinvarDeletionAccessionSet:
accession: str
reason: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionClinvarDeletion:
accessionSet: typing.List[SubmissionClinvarDeletionAccessionSet]
@attrs.define(frozen=True)
class SubmissionChromosomeCoordinates:
alternateAllele: typing.Optional[str] = None
accession: typing.Optional[str] = None
assembly: typing.Optional[Assembly] = None
chromosome: typing.Optional[Chromosome] = None
innerStart: typing.Optional[int] = None
innerStop: typing.Optional[int] = None
outerStart: typing.Optional[int] = None
outerStop: typing.Optional[int] = None
referenceAllele: typing.Optional[str] = None
start: typing.Optional[int] = None
stop: typing.Optional[int] = None
variantLength: typing.Optional[int] = None
@attrs.define(frozen=True)
class SubmissionVariantGene:
id: typing.Optional[int] = None
symbol: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionVariant:
chromosomeCoordinates: typing.Optional[SubmissionChromosomeCoordinates] = None
copyNumber: typing.Optional[str] = None
gene: typing.Optional[typing.List[SubmissionVariantGene]] = None
hgvs: typing.Optional[str] = None
referenceCopyNumber: typing.Optional[int] = None
variantType: typing.Optional[VariantType] = None
@attrs.define(frozen=True)
class SubmissionVariantSet:
variant: typing.List[SubmissionVariant]
@attrs.define(frozen=True)
class SubmissionPhaseUnknownSet:
hgvs: str
variants: typing.List[SubmissionVariant]
@attrs.define(frozen=True)
class SubmissionClinicalFeature:
clinicalFeaturesAffectedStatus: ClinicalFeaturesAffectedStatus
db: typing.Optional[ClinicalFeaturesDb] = None
id: typing.Optional[str] = None
name: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionObservedIn:
affectedStatus: AffectedStatus
alleleOrigin: AlleleOrigin
collectionMethod: CollectionMethod
clinicalFeatures: typing.Optional[typing.List[SubmissionClinicalFeature]] = None
clinicalFeaturesComment: typing.Optional[str] = None
numberOfIndividuals: typing.Optional[int] = None
structVarMethodType: typing.Optional[StructVarMethodType] = None
@attrs.define(frozen=True)
class SubmissionHaplotypeSet:
hgvs: str
variants: typing.List[SubmissionVariant]
starAlleleName: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionDistinctChromosomesSet:
hgvs: str
#: Hast at least two elements
variants: typing.List[SubmissionVariant]
@attrs.define(frozen=True)
class SubmissionHaplotypeSets:
haplotypeSet: typing.Optional[SubmissionHaplotypeSet] = None
haplotypeSingleVariantSet: typing.Optional[SubmissionHaplotypeSet] = None
@attrs.define(frozen=True)
class SubmissionDiplotypeSet:
haplotypeSets: typing.List[SubmissionHaplotypeSets]
hgvs: str
starAlleleName: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionCitation:
db: typing.Optional[CitationDb] = None
id: typing.Optional[str] = None
url: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionAssertionCriteria:
db: typing.Optional[CitationDb] = None
id: typing.Optional[str] = None
url: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionCondition:
db: typing.Optional[ConditionDb] = None
id: typing.Optional[str] = None
name: typing.Optional[str] = None
@attrs.define(frozen=True)
class SubmissionDrugResponse:
db: typing.Optional[ConditionDb] = None
drugName: typing.Optional[str] = None
id: typing.Optional[str] = None
condition: typing.Optional[typing.List[SubmissionCondition]] = None
@attrs.define(frozen=True)
class SubmissionConditionSet:
condition: typing.Optional[typing.List[SubmissionCondition]] = None
drugResponse: typing.Optional[typing.List[SubmissionDrugResponse]] = None
@attrs.define(frozen=True)
class SubmissionCompoundHeterozygoteSetVariantSet:
variantSet: typing.Optional[SubmissionVariantSet] = None
@attrs.define(frozen=True)
class SubmissionCompoundHeterozygoteSet:
hgvs: str
# Must have two entries
variantSets: typing.List[SubmissionCompoundHeterozygoteSetVariantSet]
@attrs.define(frozen=True)
class SubmissionClinicalSignificance:
clinicalSignificanceDescription: ClinicalSignificanceDescription
citation: typing.Optional[typing.List[SubmissionCitation]] = None
comment: typing.Optional[str] = None
customAssertionScore: typing.Optional[float] = None
dateLastEvaluated: typing.Optional[str] = None
explanationOfDrugResponse: typing.Optional[str] = None
explanationOfOtherClinicalSignificance: typing.Optional[str] = None
modeOfInheritance: typing.Optional[ModeOfInheritance] = None
@attrs.define(frozen=True)
class SubmissionClinvarSubmission:
clinicalSignificance: SubmissionClinicalSignificance
conditionSet: SubmissionConditionSet
observedIn: typing.List[SubmissionObservedIn]
recordStatus: RecordStatus
clinvarAccession: typing.Optional[str] = None
compoundHeterozygoteSet: typing.Optional[SubmissionCompoundHeterozygoteSet] = None
diplotypeSet: typing.Optional[SubmissionDiplotypeSet] = None
distinctChromosomesSet: typing.Optional[SubmissionDistinctChromosomesSet] = None
#: Has at least two elements in `variants`
haplotypeSet: typing.Optional[SubmissionHaplotypeSet] = None
#: Has exactly one elements in `variants`
haplotypeSingleVariantSet: typing.Optional[SubmissionHaplotypeSet] = None
localID: typing.Optional[str] = None
localKey: typing.Optional[str] = None
phaseUnknownSet: typing.Optional[SubmissionPhaseUnknownSet] = None
variantSet: typing.Optional[SubmissionVariantSet] = None
@attrs.define(frozen=True)
class SubmissionContainer:
"""Representation of the container for a submission."""
assertionCriteria: typing.Optional[SubmissionAssertionCriteria] = None
behalfOrgID: typing.Optional[int] = None
clinvarDeletion: typing.Optional[SubmissionClinvarDeletion] = None
clinvarSubmission: typing.Optional[typing.List[SubmissionClinvarSubmission]] = None
clinvarSubmissionReleaseStatus: typing.Optional[ReleaseStatus] = None
submissionName: typing.Optional[str] = None