pyensemblrest.ensembl_config   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 812
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 619
dl 0
loc 812
rs 9.981
c 0
b 0
f 0
1
from typing import Any
2
3
from . import __version__
4
5
# Set Ensembl REST URL
6
ensembl_default_url = "https://rest.ensembl.org"
7
8
# Ensembl API lookup table
9
# Specifies the functions relevant to the Ensembl REST server
10
ensembl_api_table: dict[str, Any] = {
11
    # Archive
12
    "getArchiveById": {
13
        "doc": "Uses the given identifier to return its latest version",
14
        "url": "/archive/id/{{id}}",
15
        "method": "GET",
16
        "content_type": "application/json",
17
    },
18
    "getArchiveByMultipleIds": {
19
        "doc": "Retrieve the latest version for a set of identifiers",
20
        "url": "/archive/id",
21
        "method": "POST",
22
        "content_type": "application/json",
23
        "post_parameters": ["id"],
24
    },
25
    # Comparative Genomics
26
    "getCafeGeneTreeById": {
27
        "doc": "Retrieves a cafe tree of the gene tree using the gene tree stable identifier",
28
        "url": "/cafe/genetree/id/{{id}}",
29
        "method": "GET",
30
        "content_type": "application/json",
31
    },
32
    "getCafeGeneTreeMemberBySymbol": {
33
        "doc": "Retrieves the cafe tree of the gene tree that contains the gene identified by a symbol",
34
        "url": "/cafe/genetree/member/symbol/{{species}}/{{symbol}}",
35
        "method": "GET",
36
        "content_type": "application/json",
37
    },
38
    "getCafeGeneTreeMemberById": {
39
        "doc": "Retrieves the cafe tree of the gene tree that contains the gene / transcript / translation stable identifier in the given species",
40
        "url": "/cafe/genetree/member/id/{{species}}/{{id}}",
41
        "method": "GET",
42
        "content_type": "application/json",
43
    },
44
    "getGeneTreeById": {
45
        "doc": "Retrieves a gene tree for a gene tree stable identifier",
46
        "url": "/genetree/id/{{id}}",
47
        "method": "GET",
48
        "content_type": "application/json",
49
    },
50
    "getGeneTreeMemberBySymbol": {
51
        "doc": "Retrieves the gene tree that contains the gene identified by a symbol",
52
        "url": "/genetree/member/symbol/{{species}}/{{symbol}}",
53
        "method": "GET",
54
        "content_type": "application/json",
55
    },
56
    "getGeneTreeMemberById": {
57
        "doc": "Retrieves the gene tree that contains the gene / transcript / translation stable identifier in the given species",
58
        "url": "/genetree/member/id/{{species}}/{{id}}",
59
        "method": "GET",
60
        "content_type": "application/json",
61
    },
62
    "getAlignmentByRegion": {
63
        "doc": "Retrieves genomic alignments as separate blocks based on a region and species",
64
        "url": "/alignment/region/{{species}}/{{region}}",
65
        "method": "GET",
66
        "content_type": "application/json",
67
    },
68
    "getHomologyById": {
69
        "doc": "Retrieves homology information (orthologs) by species and Ensembl gene id",
70
        "url": "/homology/id/{{species}}/{{id}}",
71
        "method": "GET",
72
        "content_type": "application/json",
73
    },
74
    "getHomologyBySymbol": {
75
        "doc": "Retrieves homology information (orthologs) by symbol",
76
        "url": "/homology/symbol/{{species}}/{{symbol}}",
77
        "method": "GET",
78
        "content_type": "application/json",
79
    },
80
    # Cross References
81
    "getXrefsBySymbol": {
82
        "doc": """Looks up an external symbol and returns all Ensembl objects linked to it. """
83
        """This can be a display name for a gene/transcript/translation, """
84
        """a synonym or an externally linked reference. """
85
        """If a gene's transcript is linked to the supplied symbol """
86
        """the service will return both gene and transcript (it supports transient links).""",
87
        "url": "/xrefs/symbol/{{species}}/{{symbol}}",
88
        "method": "GET",
89
        "content_type": "application/json",
90
    },
91
    "getXrefsById": {
92
        "doc": "Perform lookups of Ensembl Identifiers and retrieve their external references in other databases",
93
        "url": "/xrefs/id/{{id}}",
94
        "method": "GET",
95
        "content_type": "application/json",
96
    },
97
    "getXrefsByName": {
98
        "doc": """Performs a lookup based upon the primary accession or display label of an external reference  """
99
        """and returning the information we hold about the entry""",
100
        "url": "/xrefs/name/{{species}}/{{name}}",
101
        "method": "GET",
102
        "content_type": "application/json",
103
    },
104
    # Information
105
    "getInfoAnalysis": {
106
        "doc": "List the names of analyses involved in generating Ensembl data.",
107
        "url": "/info/analysis/{{species}}",
108
        "method": "GET",
109
        "content_type": "application/json",
110
    },
111
    "getInfoAssembly": {
112
        "doc": """List the currently available assemblies for a species, along with toplevel sequences, """
113
        """chromosomes and cytogenetic bands.""",
114
        "url": "/info/assembly/{{species}}",
115
        "method": "GET",
116
        "content_type": "application/json",
117
    },
118
    "getInfoAssemblyRegion": {
119
        "doc": "Returns information about the specified toplevel sequence region for the given species.",
120
        "url": "/info/assembly/{{species}}/{{region_name}}",
121
        "method": "GET",
122
        "content_type": "application/json",
123
    },
124
    "getInfoBiotypes": {
125
        "doc": """List the functional classifications of gene models that Ensembl associates with a particular species. """
126
        """Useful for restricting the type of genes/transcripts retrieved by other endpoints.""",
127
        "url": "/info/biotypes/{{species}}",
128
        "method": "GET",
129
        "content_type": "application/json",
130
    },
131
    "getInfoBiotypesByGroup": {
132
        "doc": """Without argument the list of available biotype groups is returned. With :group argument provided, list the properties of biotypes within that group. """
133
        """Object type (gene or transcript) can be provided for filtering.""",
134
        "url": "/info/biotypes/groups/{{group}}/{{object_type}}",
135
        "method": "GET",
136
        "content_type": "application/json",
137
    },
138
    "getInfoBiotypesByName": {
139
        "doc": """List the properties of biotypes with a given name. """
140
        """Object type (gene or transcript) can be provided for filtering.""",
141
        "url": "/info/biotypes/name/{{name}}/{{object_type}}",
142
        "method": "GET",
143
        "content_type": "application/json",
144
    },
145
    "getInfoComparaMethods": {
146
        "doc": "List all compara analyses available (an analysis defines the type of comparative data).",
147
        "url": "/info/compara/methods",
148
        "method": "GET",
149
        "content_type": "application/json",
150
    },
151
    "getInfoComparaSpeciesSets": {
152
        "doc": "List all collections of species analysed with the specified compara method.",
153
        "url": "/info/compara/species_sets/{{methods}}",
154
        "method": "GET",
155
        "content_type": "application/json",
156
    },
157
    "getInfoComparas": {
158
        "doc": """Lists all available comparative genomics databases and their data release. """
159
        """DEPRECATED: use info/genomes/division instead.""",
160
        "url": "/info/comparas",
161
        "method": "GET",
162
        "content_type": "application/json",
163
    },
164
    "getInfoData": {
165
        "doc": """Shows the data releases available on this REST server. """
166
        """May return more than one release (unfrequent non-standard Ensembl configuration).""",
167
        "url": "/info/data",
168
        "method": "GET",
169
        "content_type": "application/json",
170
    },
171
    "getInfoEgVersion": {
172
        "doc": "Returns the Ensembl Genomes version of the databases backing this service",
173
        "url": "/info/eg_version",
174
        "method": "GET",
175
        "content_type": "application/json",
176
    },
177
    "getInfoExternalDbs": {
178
        "doc": "Lists all available external sources for a species.",
179
        "url": "/info/external_dbs/{{species}}",
180
        "method": "GET",
181
        "content_type": "application/json",
182
    },
183
    "getInfoDivisions": {
184
        "doc": "Get list of all Ensembl divisions for which information is available",
185
        "url": "/info/divisions",
186
        "method": "GET",
187
        "content_type": "application/json",
188
    },
189
    "getInfoGenomesByName": {
190
        "doc": "Find information about a given genome",
191
        "url": "/info/genomes/{{name}}",
192
        "method": "GET",
193
        "content_type": "application/json",
194
    },
195
    "getInfoGenomesByAccession": {
196
        "doc": "Find information about genomes containing a specified INSDC accession",
197
        "url": "/info/genomes/accession/{{accession}}",
198
        "method": "GET",
199
        "content_type": "application/json",
200
    },
201
    "getInfoGenomesByAssembly": {
202
        "doc": "Find information about a genome with a specified assembly",
203
        "url": "/info/genomes/assembly/{{assembly_id}}",
204
        "method": "GET",
205
        "content_type": "application/json",
206
    },
207
    "getInfoGenomesByDivision": {
208
        "doc": "Find information about all genomes in a given division. May be large for Ensembl Bacteria.",
209
        "url": "/info/genomes/division/{{division}}",
210
        "method": "GET",
211
        "content_type": "application/json",
212
    },
213
    "getInfoGenomesByTaxonomy": {
214
        "doc": "Find information about all genomes beneath a given node of the taxonomy",
215
        "url": "/info/genomes/taxonomy/{{taxon_name}}",
216
        "method": "GET",
217
        "content_type": "application/json",
218
    },
219
    "getInfoPing": {
220
        "doc": "Checks if the service is alive.",
221
        "url": "/info/ping",
222
        "method": "GET",
223
        "content_type": "application/json",
224
    },
225
    "getInfoRest": {
226
        "doc": "Shows the current version of the Ensembl REST API.",
227
        "url": "/info/rest",
228
        "method": "GET",
229
        "content_type": "application/json",
230
    },
231
    "getInfoSoftware": {
232
        "doc": "Shows the current version of the Ensembl API used by the REST server.",
233
        "url": "/info/software",
234
        "method": "GET",
235
        "content_type": "application/json",
236
    },
237
    "getInfoSpecies": {
238
        "doc": "Lists all available species, their aliases, available adaptor groups and data release.",
239
        "url": "/info/species",
240
        "method": "GET",
241
        "content_type": "application/json",
242
    },
243
    "getInfoVariationBySpecies": {
244
        "doc": "List the variation sources used in Ensembl for a species.",
245
        "url": "/info/variation/{{species}}",
246
        "method": "GET",
247
        "content_type": "application/json",
248
    },
249
    "getInfoVariationConsequenceTypes": {
250
        "doc": "Lists all variant consequence types.",
251
        "url": "/info/variation/consequence_types",
252
        "method": "GET",
253
        "content_type": "application/json",
254
    },
255
    "getInfoVariationPopulationIndividuals": {
256
        "doc": "List all individuals for a population from a species",
257
        "url": "/info/variation/populations/{{species}}/{{population_name}}",
258
        "method": "GET",
259
        "content_type": "application/json",
260
    },
261
    "getInfoVariationPopulations": {
262
        "doc": "List all populations for a species",
263
        "url": "/info/variation/populations/{{species}}",
264
        "method": "GET",
265
        "content_type": "application/json",
266
    },
267
    # Linkage Disequilibrium
268
    "getLdId": {
269
        "doc": """Computes and returns LD values between the given variant and all other variants """
270
        """in a window centered around the given variant. The window size is set to 500 kb.""",
271
        "url": "/ld/{{species}}/{{id}}/{{population_name}}",
272
        "method": "GET",
273
        "content_type": "application/json",
274
    },
275
    "getLdPairwise": {
276
        "doc": "Computes and returns LD values between the given variants.",
277
        "url": "/ld/{{species}}/pairwise/{{id1}}/{{id2}}",
278
        "method": "GET",
279
        "content_type": "application/json",
280
    },
281
    "getLdRegion": {
282
        "doc": "Computes and returns LD values between all pairs of variants in the defined region.",
283
        "url": "/ld/{{species}}/region/{{region}}/{{population_name}}",
284
        "method": "GET",
285
        "content_type": "application/json",
286
    },
287
    # Lookup
288
    "getLookupById": {
289
        "doc": "Find the species and database for a single identifier e.g. gene, transcript, protein",
290
        "url": "/lookup/id/{{id}}",
291
        "method": "GET",
292
        "content_type": "application/json",
293
    },
294
    "getLookupByMultipleIds": {
295
        "doc": """Find the species and database for several identifiers. """
296
        """IDs that are not found are returned with no data.""",
297
        "url": "/lookup/id",
298
        "method": "POST",
299
        "content_type": "application/json",
300
        "post_parameters": ["ids"],
301
    },
302
    "getLookupBySymbol": {
303
        "doc": "Find the species and database for a symbol in a linked external database",
304
        "url": "/lookup/symbol/{{species}}/{{symbol}}",
305
        "method": "GET",
306
        "content_type": "application/json",
307
    },
308
    "getLookupByMultipleSymbols": {
309
        "doc": """Find the species and database for a set of symbols in a linked external database. """
310
        """Unknown symbols are omitted from the response.""",
311
        "url": "/lookup/symbol/{{species}}",
312
        "method": "POST",
313
        "content_type": "application/json",
314
        "post_parameters": ["symbols"],
315
    },
316
    # Mapping
317
    "getMapCdnaToRegion": {
318
        "doc": """Convert from cDNA coordinates to genomic coordinates. """
319
        """Output reflects forward orientation coordinates as returned from the Ensembl API.""",
320
        "url": "/map/cdna/{{id}}/{{region}}",
321
        "method": "GET",
322
        "content_type": "application/json",
323
    },
324
    "getMapCdsToRegion": {
325
        "doc": """Convert from CDS coordinates to genomic coordinates. """
326
        """Output reflects forward orientation coordinates as returned from the Ensembl API.""",
327
        "url": "/map/cds/{{id}}/{{region}}",
328
        "method": "GET",
329
        "content_type": "application/json",
330
    },
331
    "getMapAssemblyOneToTwo": {
332
        "doc": "Convert the co-ordinates of one assembly to another",
333
        "url": "/map/{{species}}/{{asm_one}}/{{region}}/{{asm_two}}",
334
        "method": "GET",
335
        "content_type": "application/json",
336
    },
337
    "getMapTranslationToRegion": {
338
        "doc": """Convert from protein (translation) coordinates to genomic coordinates. """
339
        """Output reflects forward orientation coordinates as returned from the Ensembl API.""",
340
        "url": "/map/translation/{{id}}/{{region}}",
341
        "method": "GET",
342
        "content_type": "application/json",
343
    },
344
    # Ontologies and Taxonomy
345
    "getAncestorsById": {
346
        "doc": "Reconstruct the entire ancestry of a term from is_a and part_of relationships",
347
        "url": "/ontology/ancestors/{{id}}",
348
        "method": "GET",
349
        "content_type": "application/json",
350
    },
351
    "getAncestorsChartById": {
352
        "doc": "Reconstruct the entire ancestry of a term from is_a and part_of relationships.",
353
        "url": "/ontology/ancestors/chart/{{id}}",
354
        "method": "GET",
355
        "content_type": "application/json",
356
    },
357
    "getDescendantsById": {
358
        "doc": """Find all the terms descended from a given term. """
359
        """By default searches are conducted within the namespace of the given identifier""",
360
        "url": "/ontology/descendants/{{id}}",
361
        "method": "GET",
362
        "content_type": "application/json",
363
    },
364
    "getOntologyById": {
365
        "doc": "Search for an ontological term by its namespaced identifier",
366
        "url": "/ontology/id/{{id}}",
367
        "method": "GET",
368
        "content_type": "application/json",
369
    },
370
    "getOntologyByName": {
371
        "doc": "Search for a list of ontological terms by their name",
372
        "url": "/ontology/name/{{name}}",
373
        "method": "GET",
374
        "content_type": "application/json",
375
    },
376
    "getTaxonomyClassificationById": {
377
        "doc": "Return the taxonomic classification of a taxon node",
378
        "url": "/taxonomy/classification/{{id}}",
379
        "method": "GET",
380
        "content_type": "application/json",
381
    },
382
    "getTaxonomyById": {
383
        "doc": "Search for a taxonomic term by its identifier or name",
384
        "url": "/taxonomy/id/{{id}}",
385
        "method": "GET",
386
        "content_type": "application/json",
387
    },
388
    "getTaxonomyByName": {
389
        "doc": "Search for a taxonomic id by a non-scientific name",
390
        "url": "/taxonomy/name/{{name}}",
391
        "method": "GET",
392
        "content_type": "application/json",
393
    },
394
    # Overlap
395
    "getOverlapById": {
396
        "doc": """Retrieves features (e.g. genes, transcripts, variants and more) """
397
        """that overlap a region defined by the given identifier.""",
398
        "url": "/overlap/id/{{id}}",
399
        "method": "GET",
400
        "content_type": "application/json",
401
    },
402
    "getOverlapByRegion": {
403
        "doc": """Retrieves features (e.g. genes, transcripts, variants and more) """
404
        """that overlap a given region.""",
405
        "url": "/overlap/region/{{species}}/{{region}}",
406
        "method": "GET",
407
        "content_type": "application/json",
408
    },
409
    "getOverlapByTranslation": {
410
        "doc": """Retrieve features related to a specific Translation as described """
411
        """by its stable ID (e.g. domains, variants).""",
412
        "url": "/overlap/translation/{{id}}",
413
        "method": "GET",
414
        "content_type": "application/json",
415
    },
416
    # Phenotype annotations
417
    "getPhenotypeByAccession": {
418
        "doc": "Return phenotype annotations for genomic features given a phenotype ontology accession",
419
        "url": "/phenotype/accession/{{species}}/{{accession}}",
420
        "method": "GET",
421
        "content_type": "application/json",
422
    },
423
    "getPhenotypeByGene": {
424
        "doc": "Return phenotype annotations for a given gene.",
425
        "url": "/phenotype/gene/{{species}}/{{gene}}",
426
        "method": "GET",
427
        "content_type": "application/json",
428
    },
429
    "getPhenotypeByRegion": {
430
        "doc": "Return phenotype annotations that overlap a given genomic region.",
431
        "url": "/phenotype/region/{{species}}/{{region}}",
432
        "method": "GET",
433
        "content_type": "application/json",
434
    },
435
    "getPhenotypeByTerm": {
436
        "doc": "Return phenotype annotations for genomic features given a phenotype ontology term",
437
        "url": "/phenotype/term/{{species}}/{{term}}",
438
        "method": "GET",
439
        "content_type": "application/json",
440
    },
441
    # Regulation
442
    "getRegulationBindingMatrix": {
443
        "doc": "Return the specified binding matrix",
444
        "url": "/species/{{species}}/binding_matrix/{{binding_matrix}}/",
445
        "method": "GET",
446
        "content_type": "application/json",
447
    },
448
    # Sequences
449
    "getSequenceById": {
450
        "doc": """Request multiple types of sequence by stable identifier. """
451
        """Supports feature masking and expand options.""",
452
        "url": "/sequence/id/{{id}}",
453
        "method": "GET",
454
        "content_type": "application/json",
455
    },
456
    "getSequenceByMultipleIds": {
457
        "doc": "Request multiple types of sequence by a stable identifier list.",
458
        "url": "/sequence/id",
459
        "method": "POST",
460
        "content_type": "application/json",
461
        "post_parameters": ["ids"],
462
    },
463
    "getSequenceByRegion": {
464
        "doc": """Returns the genomic sequence of the specified region of the given species. """
465
        """Supports feature masking and expand options.""",
466
        "url": "/sequence/region/{{species}}/{{region}}",
467
        "method": "GET",
468
        "content_type": "application/json",
469
    },
470
    "getSequenceByMultipleRegions": {
471
        "doc": "Request multiple types of sequence by a list of regions.",
472
        "url": "/sequence/region/{{species}}",
473
        "method": "POST",
474
        "content_type": "application/json",
475
        "post_parameters": ["regions"],
476
    },
477
    # Transcript Haplotypes
478
    "getTranscriptHaplotypes": {
479
        "doc": "Computes observed transcript haplotype sequences based on phased genotype data",
480
        "url": "/transcript_haplotypes/{{species}}/{{id}}",
481
        "method": "GET",
482
        "content_type": "application/json",
483
    },
484
    # VEP
485
    "getVariantConsequencesByHGVSNotation": {
486
        "doc": "Fetch variant consequences based on a HGVS notation",
487
        "url": "/vep/{{species}}/hgvs/{{hgvs_notation}}",
488
        "method": "GET",
489
        "content_type": "application/json",
490
    },
491
    "getVariantConsequencesByMultipleHGVSNotations": {
492
        "doc": "Fetch variant consequences for multiple HGVS notations",
493
        "url": "/vep/{{species}}/hgvs/",
494
        "method": "POST",
495
        "content_type": "application/json",
496
        "post_parameters": ["hgvs_notations"],
497
    },
498
    "getVariantConsequencesById": {
499
        "doc": "Fetch variant consequences based on a variant identifier",
500
        "url": "/vep/{{species}}/id/{{id}}",
501
        "method": "GET",
502
        "content_type": "application/json",
503
    },
504
    "getVariantConsequencesByMultipleIds": {
505
        "doc": "Fetch variant consequences for multiple ids",
506
        "url": "/vep/{{species}}/id",
507
        "method": "POST",
508
        "content_type": "application/json",
509
        "post_parameters": ["ids"],
510
    },
511
    "getVariantConsequencesByRegion": {
512
        "doc": "Fetch variant consequences",
513
        "url": "/vep/{{species}}/region/{{region}}/{{allele}}",
514
        "method": "GET",
515
        "content_type": "application/json",
516
    },
517
    "getVariantConsequencesByMultipleRegions": {
518
        "doc": "Fetch variant consequences for multiple regions",
519
        "url": "/vep/{{species}}/region",
520
        "method": "POST",
521
        "content_type": "application/json",
522
        "post_parameters": ["variants"],
523
    },
524
    # Variation
525
    "getVariationRecoderById": {
526
        "doc": """Translate a variant identifier, HGVS notation or genomic SPDI notation """
527
        """to all possible variant IDs, HGVS and genomic SPDI""",
528
        "url": "/variant_recoder/{{species}}/{{id}}",
529
        "method": "GET",
530
        "content_type": "application/json",
531
    },
532
    "getVariationRecoderByMultipleIds": {
533
        "doc": """Translate a list of variant identifiers, HGVS notations or genomic SPDI """
534
        """notations to all possible variant IDs, HGVS and genomic SPDI""",
535
        "url": "/variant_recoder/{{species}}",
536
        "method": "POST",
537
        "content_type": "application/json",
538
        "post_parameters": ["ids"],
539
    },
540
    "getVariationById": {
541
        "doc": """Uses a variant identifier (e.g. rsID) to return the variation features """
542
        """including optional genotype, phenotype and population data""",
543
        "url": "/variation/{{species}}/{{id}}",
544
        "method": "GET",
545
        "content_type": "application/json",
546
    },
547
    "getVariationByPMCID": {
548
        "doc": """Uses a variant identifier (e.g. rsID) to return the variation features """
549
        """including optional genotype, phenotype and population data""",
550
        "url": "/variation/{{species}}/pmcid/{{pmcid}}",
551
        "method": "GET",
552
        "content_type": "application/json",
553
    },
554
    "getVariationByPMID": {
555
        "doc": """Uses a variant identifier (e.g. rsID) to return the variation features """
556
        """including optional genotype, phenotype and population data""",
557
        "url": "/variation/{{species}}/pmid/{{pmid}}",
558
        "method": "GET",
559
        "content_type": "application/json",
560
    },
561
    "getVariationByMultipleIds": {
562
        "doc": """Uses a list of variant identifiers (e.g. rsID) to return the variation features """
563
        """including optional genotype, phenotype and population data """,
564
        "url": "/variation/{{species}}",
565
        "method": "POST",
566
        "content_type": "application/json",
567
        "post_parameters": ["ids"],
568
    },
569
    # Variation GA4GH
570
    "getGA4GHBeacon": {
571
        "doc": "Return Beacon information",
572
        "url": "/ga4gh/beacon",
573
        "method": "GET",
574
        "content_type": "application/json",
575
    },
576
    "getGA4GHBeaconQuery": {
577
        "doc": "Return the Beacon response for allele information",
578
        "url": "/ga4gh/beacon/query?"
579
        "alternateBases={{alternateBases}};"
580
        "assemblyId={{assemblyId}};"
581
        "referenceBases={{referenceBases}};"
582
        "referenceName={{referenceName}};"
583
        "start={{start}}",
584
        "method": "GET",
585
        "content_type": "application/json",
586
    },
587
    "postGA4GHBeaconQuery": {
588
        "doc": "Return the Beacon response for allele information",
589
        "url": "/ga4gh/beacon/query",
590
        "method": "POST",
591
        "content_type": "application/json",
592
        "post_parameters": [
593
            "alternateBases",
594
            "assemblyId",
595
            "end",
596
            "referenceBases",
597
            "referenceName",
598
            "start",
599
            "variantType",
600
        ],
601
    },
602
    "getGA4GHFeaturesById": {
603
        "doc": "Return the GA4GH record for a specific sequence feature given its identifier",
604
        "url": "/ga4gh/features/{{id}}",
605
        "method": "GET",
606
        "content_type": "application/json",
607
    },
608
    "searchGA4GHFeatures": {
609
        "doc": "Return a list of sequence annotation features in GA4GH format",
610
        "url": "/ga4gh/features/search",
611
        "method": "POST",
612
        "content_type": "application/json",
613
        "post_parameters": [
614
            "end",
615
            "referenceName",
616
            "start",
617
            "featureSetId",
618
            "parentId",
619
        ],
620
    },
621
    "searchGA4GHCallset": {
622
        "doc": "Return a list of sets of genotype calls for specific samples in GA4GH format",
623
        "url": "/ga4gh/callsets/search",
624
        "method": "POST",
625
        "content_type": "application/json",
626
        "post_parameters": ["variantSetId", "name", "pageToken", "pageSize"],
627
    },
628
    "getGA4GHCallsetById": {
629
        "doc": "Return the GA4GH record for a specific CallSet given its identifier",
630
        "url": "/ga4gh/callsets/{{id}}",
631
        "method": "GET",
632
        "content_type": "application/json",
633
    },
634
    "searchGA4GHDatasets": {
635
        "doc": "Return a list of datasets in GA4GH format",
636
        "url": "/ga4gh/datasets/search",
637
        "method": "POST",
638
        "content_type": "application/json",
639
        "post_parameters": ["pageToken", "pageSize"],
640
    },
641
    "getGA4GHDatasetsById": {
642
        "doc": "Return the GA4GH record for a specific dataset given its identifier",
643
        "url": "/ga4gh/datasets/{{id}}",
644
        "method": "GET",
645
        "content_type": "application/json",
646
    },
647
    "searchGA4GHFeaturesets": {
648
        "doc": "Return a list of feature sets in GA4GH format",
649
        "url": "/ga4gh/featuresets/search",
650
        "method": "POST",
651
        "content_type": "application/json",
652
        "post_parameters": ["datasetId", "pageToken", "pageSize"],
653
    },
654
    "getGA4GHFeaturesetsById": {
655
        "doc": "Return the GA4GH record for a specific featureSet given its identifier",
656
        "url": "/ga4gh/featuresets/{{id}}",
657
        "method": "GET",
658
        "content_type": "application/json",
659
    },
660
    "getGA4GHVariantsById": {
661
        "doc": "Return the GA4GH record for a specific variant given its identifier.",
662
        "url": "/ga4gh/variants/{{id}}",
663
        "method": "GET",
664
        "content_type": "application/json",
665
    },
666
    "searchGA4GHVariantAnnotations": {
667
        "doc": "Return variant annotation information in GA4GH format for a region on a reference sequence",
668
        "url": "/ga4gh/variantannotations/search",
669
        "method": "POST",
670
        "content_type": "application/json",
671
        "post_parameters": [
672
            "variantAnnotationSetId",
673
            "effects",
674
            "end",
675
            "pageSize",
676
            "pageToken",
677
            "referenceId",
678
            "referenceName",
679
            "start",
680
        ],
681
    },
682
    "searchGA4GHVariants": {
683
        "doc": "Return variant call information in GA4GH format for a region on a reference sequence",
684
        "url": "/ga4gh/variants/search",
685
        "method": "POST",
686
        "content_type": "application/json",
687
        "post_parameters": [
688
            "variantSetId",
689
            "callSetIds",
690
            "referenceName",
691
            "start",
692
            "end",
693
            "pageToken",
694
            "pageSize",
695
        ],
696
    },
697
    "searchGA4GHVariantsets": {
698
        "doc": "Return a list of variant sets in GA4GH format",
699
        "url": "/ga4gh/variantsets/search",
700
        "method": "POST",
701
        "content_type": "application/json",
702
        "post_parameters": ["datasetId", "pageToken", "pageSize"],
703
    },
704
    "getGA4GHVariantsetsById": {
705
        "doc": "Return the GA4GH record for a specific VariantSet given its identifier",
706
        "url": "/ga4gh/variantsets/{{id}}",
707
        "method": "GET",
708
        "content_type": "application/json",
709
    },
710
    "searchGA4GHReferences": {
711
        "doc": "Return a list of reference sequences in GA4GH format",
712
        "url": "/ga4gh/references/search",
713
        "method": "POST",
714
        "content_type": "application/json",
715
        "post_parameters": [
716
            "referenceSetId",
717
            "md5checksum",
718
            "accession",
719
            "pageToken",
720
            "pageSize",
721
        ],
722
    },
723
    "getGA4GHReferencesById": {
724
        "doc": "Return data for a specific reference in GA4GH format by id",
725
        "url": "/ga4gh/references/{{id}}",
726
        "method": "GET",
727
        "content_type": "application/json",
728
    },
729
    "searchGA4GHReferencesets": {
730
        "doc": "Return a list of reference sets in GA4GH format",
731
        "url": "/ga4gh/referencesets/search",
732
        "method": "POST",
733
        "content_type": "application/json",
734
        "post_parameters": ["accession", "pageToken", "pageSize"],
735
    },
736
    "getGA4GHReferencesetsById": {
737
        "doc": "Return data for a specific reference set in GA4GH format",
738
        "url": "/ga4gh/referencesets/{{id}}",
739
        "method": "GET",
740
        "content_type": "application/json",
741
    },
742
    "searchGA4GHVariantAnnotationsets": {
743
        "doc": "Return a list of annotation sets in GA4GH format",
744
        "url": "/ga4gh/variantannotationsets/search",
745
        "method": "POST",
746
        "content_type": "application/json",
747
        "post_parameters": ["variantSetId", "pageToken", "pageSize"],
748
    },
749
    "getGA4GHVariantAnnotationsetsById": {
750
        "doc": "Return meta data for a specific annotation set in GA4GH format",
751
        "url": "/ga4gh/variantannotationsets/{{id}}",
752
        "method": "GET",
753
        "content_type": "application/json",
754
    },
755
}
756
757
# Define HTTP status codes
758
ensembl_http_status_codes: dict[int, Any] = {
759
    200: (
760
        "OK",
761
        "Request was a success. Only process data from the service when you receive this code",
762
    ),
763
    400: (
764
        "Bad Request",
765
        "Occurs during exceptional circumstances such as the service is unable to find an ID. "
766
        "Check if the response Content-type or Accept was JSON. "
767
        "If so the JSON object is an exception hash with the message keyed under error",
768
    ),
769
    403: (
770
        "Forbidden",
771
        "You are submitting far too many requests and have been temporarily forbidden access to the service. "
772
        "Wait and retry with a maximum of 15 requests per second.",
773
    ),
774
    404: ("Not Found", "Indicates a badly formatted request. Check your URL"),
775
    408: ("Timeout", "The request was not processed in time. Wait and retry later"),
776
    415: (
777
        "Unsupported Media Type",
778
        "The server is refusing to service the request "
779
        "because the entity of the request is in a format not supported "
780
        "by the requested resource for the requested method",
781
    ),
782
    429: (
783
        "Too Many Requests",
784
        "You have been rate-limited; wait and retry. "
785
        "The headers X-RateLimit-Reset, X-RateLimit-Limit and X-RateLimit-Remaining will inform you "
786
        "of how long you have until your limit is reset and what that limit was. "
787
        "If you get this response and have not exceeded your limit then check "
788
        "if you have made too many requests per second.",
789
    ),
790
    500: (
791
        "Internal Server Error",
792
        "This error is not documented. Maybe there is an error in user input or "
793
        "the REST server could have problems. Try to do the query with curl. "
794
        "If your data input and query are correct, contact the Ensembl team",
795
    ),
796
    503: (
797
        "Service Unavailable",
798
        "The service is temporarily down; retry after a pause",
799
    ),
800
}
801
802
# Set the user agent
803
ensembl_user_agent = "pyEnsemblRest v" + __version__
804
ensembl_header = {"User-Agent": ensembl_user_agent}
805
ensembl_content_type = "application/json"
806
807
# Define known errors
808
ensembl_known_errors = [
809
    "something bad has happened",
810
    "Something went wrong while fetching from LDFeatureContainerAdaptor",
811
    "%s timeout" % ensembl_user_agent,
812
]
813