-
Notifications
You must be signed in to change notification settings - Fork 172
/
htsget-openapi.yaml
712 lines (678 loc) · 22.5 KB
/
htsget-openapi.yaml
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
openapi: 3.0.3
servers:
- description: htsget genomics api
url: htsget/1
info:
description: This data retrieval API bridges from existing genomics bulk data transfers to a client/server model
version: 1.3.0
title: htsget
contact:
name: GA4GH
email: [email protected]
externalDocs:
description: htsget specification
url: https://samtools.github.io/hts-specs/htsget.html
paths:
/reads/{id}:
get:
summary: Gets the reads from a pre-indexed id
operationId: searchReadId
description: |
Searches a pre-indexed object id
parameters:
- $ref: '#/components/parameters/idPathParam'
- in: query
name: format
required: false
schema:
$ref: '#/components/schemas/FormatReads'
- $ref: '#/components/parameters/classParam'
- $ref: '#/components/parameters/referenceNameParam'
- $ref: '#/components/parameters/startParam'
- $ref: '#/components/parameters/endParam'
- in: query
name: fields
required: false
schema:
$ref: '#/components/schemas/FieldsReads'
- in: query
name: tags
required: false
schema:
$ref: '#/components/schemas/TagsReads'
- in: query
name: notags
required: false
schema:
$ref: '#/components/schemas/NoTagsReads'
responses:
200:
description: results matching criteria
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetResponseReads'
400:
$ref: '#/components/responses/400BadRequestResponse'
401:
$ref: '#/components/responses/401UnauthorizedResponse'
403:
$ref: '#/components/responses/403ForbiddenResponse'
404:
$ref: '#/components/responses/404NotFoundResponse'
500:
$ref: '#/components/responses/500InternalServerErrorResponse'
default:
$ref: '#/components/responses/500InternalServerErrorResponse'
security:
- htsget_auth:
- read:genomic_reads
post:
summary: Get htsget ticket for reads data streaming
operationId: postRead
description: |
Servers may optionally accept `POST` requests to enable alignment data
streaming of more than one genomic region
parameters:
- $ref: '#/components/parameters/idPathParam'
requestBody:
description: Specify output format, fields, genomic regions, etc.
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/RequestBodyReads'
responses:
200:
description: Successfully retrieved ticket for streaming alignment file
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetResponseReads'
400:
$ref: '#/components/responses/400BadRequestResponse'
401:
$ref: '#/components/responses/401UnauthorizedResponse'
403:
$ref: '#/components/responses/403ForbiddenResponse'
404:
$ref: '#/components/responses/404NotFoundResponse'
413:
$ref: '#/components/responses/413PayloadTooLargeResponse'
500:
$ref: '#/components/responses/500InternalServerErrorResponse'
default:
$ref: '#/components/responses/500InternalServerErrorResponse'
/variants/{id}:
get:
summary: Gets the variants from a pre-indexed id
operationId: searchVariantId
description: Searches a pre-indexed object id
parameters:
- $ref: '#/components/parameters/idPathParam'
- in: query
name: format
required: false
schema:
$ref: '#/components/schemas/FormatVariants'
- $ref: '#/components/parameters/classParam'
- $ref: '#/components/parameters/referenceNameParam'
- $ref: '#/components/parameters/startParam'
- $ref: '#/components/parameters/endParam'
- in: query
name: tags
required: false
schema:
$ref: '#/components/schemas/TagsVariants'
- in: query
name: notags
required: false
schema:
$ref: '#/components/schemas/NoTagsVariants'
responses:
200:
description: results matching criteria
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetResponseVariants'
400:
$ref: '#/components/responses/400BadRequestResponse'
401:
$ref: '#/components/responses/401UnauthorizedResponse'
403:
$ref: '#/components/responses/403ForbiddenResponse'
404:
$ref: '#/components/responses/404NotFoundResponse'
500:
$ref: '#/components/responses/500InternalServerErrorResponse'
default:
$ref: '#/components/responses/500InternalServerErrorResponse'
security:
- htsget_auth:
- read:genomic_variants
post:
summary: Get htsget ticket for variant data streaming
operationId: postVariant
description: |
Servers may optionally accept `POST` requests to enable variant data
streaming of more than one genomic region.
parameters:
- $ref: '#/components/parameters/idPathParam'
requestBody:
description: Specify output format, genomic regions, etc.
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/RequestBodyVariants'
responses:
200:
description: Successfully retrieved ticket for streaming variant file
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetResponseVariants'
400:
$ref: '#/components/responses/400BadRequestResponse'
401:
$ref: '#/components/responses/401UnauthorizedResponse'
403:
$ref: '#/components/responses/403ForbiddenResponse'
404:
$ref: '#/components/responses/404NotFoundResponse'
413:
$ref: '#/components/responses/413PayloadTooLargeResponse'
500:
$ref: '#/components/responses/500InternalServerErrorResponse'
default:
$ref: '#/components/responses/500InternalServerErrorResponse'
/reads/service-info:
get:
summary: Get htsget reads API service info
description: Retrieves GA4GH Service Info, and htsget reads API features supported by the web service
operationId: readsServiceInfo
responses:
'200':
description: displays configuration of htsget service reads API
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetServiceInfo'
'500':
description: Internal Server Error
/variants/service-info:
get:
summary: Get htsget variants API service info
description: Retrieves GA4GH Service Info, and htsget variants API features supported by the web service
operationId: variantsServiceInfo
responses:
'200':
description: displays configuration of htsget service variants API
content:
application/json:
schema:
$ref: '#/components/schemas/htsgetServiceInfo'
'500':
description: Internal Server Error
components:
schemas:
htsgetResponse:
type: object
required:
- htsget
properties:
htsget:
type: object
description: Container for response object
required:
- format
properties:
format:
type: string
description: Response data is in this format
md5:
type: string
description: MD5 digest of the blob resulting from concatenating all of the payload data
example: 8a6049fad4943ff4c6de5c22df97d001
htsgetResponseReads:
allOf:
- $ref: '#/components/schemas/htsgetResponse'
- properties:
htsget:
properties:
format:
example: BAM
enum: [BAM, CRAM]
urls:
type: array
description: An array providing URLs from which raw alignment data can be retrieved
items:
$ref: '#/components/schemas/htsgetUrlReads'
required:
- urls
htsgetResponseVariants:
allOf:
- $ref: '#/components/schemas/htsgetResponse'
- properties:
htsget:
properties:
format:
example: VCF
enum: [VCF, BCF]
urls:
type: array
description: An array providing URLs from which raw variant data can be retrieved
items:
$ref: '#/components/schemas/htsgetUrlVariants'
required:
- urls
htsgetUrl:
type: object
required:
- url
properties:
url:
type: string
description: URL to download data block
headers:
type: object
description: JSON object of key-value pairs representing HTTP headers. If supplied, the client MUST provide these as headers to the data download url
class:
type: string
description: Indicates whether the header or body of the requested file will be retrieved by this url
example: body
enum: [header, body]
htsgetUrlReads:
allOf:
- $ref: '#/components/schemas/htsgetUrl'
- example:
- url: data:application/vnd.ga4gh.vcf;base64,QkFNAQ==
- url: https://htsget.blocksrv.example/sample1234/run1.bam
headers:
Authorization: Bearer xxxxx
Range: bytes=65536-1003750
htsgetUrlVariants:
allOf:
- $ref: '#/components/schemas/htsgetUrl'
- example:
- url: https://example.com/sample1234/run1.vcf
FormatReads:
type: string
description: Desired alignment file format
enum: [BAM, CRAM]
example: BAM
default: BAM
FormatVariants:
type: string
description: Desired variant file format
enum: [VCF, BCF]
example: VCF
default: VCF
Class:
type: string
description: Request different classes of data. By default, i.e., when class is not specified, the response will represent a complete read or variant data stream, encompassing SAM/CRAM/VCF headers, body data records, and EOF marker
enum: [header]
example: header
ReferenceName:
type: string
description: Reference sequence name
example: chr1
Start:
type: integer
description: The start position of the range on the reference, 0-based, inclusive
format: int64
minimum: 0
example: 12312
End:
type: integer
description: The end position of the range on the reference, 0-based exclusive
format: int64
minimum: 0
example: 99999
Region:
type: object
description: A genomic region to return
properties:
referenceName:
$ref: '#/components/schemas/ReferenceName'
start:
$ref: '#/components/schemas/Start'
end:
$ref: '#/components/schemas/End'
required:
- referenceName
FieldsReads:
type: array
description: A list of SAM fields to include. By default, i.e., when fields is not specified, all fields will be included
items:
type: string
example: [QNAME, RNAME]
enum:
- QNAME
- FLAG
- RNAME
- POS
- MAPQ
- CIGAR
- RNEXT
- PNEXT
- TLEN
- SEQ
- QUAL
TagsReads:
type: array
description: A list of SAM tags to include. By default, i.e., when tags is not specified, all tags will be included
items:
type: string
example: [MD, NM]
TagsVariants:
type: array
description: A list of tags to include, by default all
items:
type: string
NoTagsReads:
type: array
description: A list of SAM tags to exclude. By default, i.e., when notags is not specified, no tags will be excluded
items:
type: string
example: [OQ]
NoTagsVariants:
type: array
description: A list of tags to exclude, default none
RequestBody:
type: object
properties:
regions:
type: array
description: A list of genomic regions to return. If not present, the entire file will be returned.
items:
$ref: '#/components/schemas/Region'
RequestBodyReads:
allOf:
- type: object
properties:
format:
$ref: '#/components/schemas/FormatReads'
class:
$ref: '#/components/schemas/Class'
fields:
$ref: '#/components/schemas/FieldsReads'
tags:
$ref: '#/components/schemas/TagsReads'
notags:
$ref: '#/components/schemas/NoTagsReads'
- $ref: '#/components/schemas/RequestBody'
RequestBodyVariants:
allOf:
- type: object
properties:
format:
$ref: '#/components/schemas/FormatVariants'
class:
$ref: '#/components/schemas/Class'
tags:
$ref: '#/components/schemas/TagsVariants'
notags:
$ref: '#/components/schemas/NoTagsVariants'
- $ref: '#/components/schemas/RequestBody'
ServiceInfo:
type: object
'$ref': https://raw.githubusercontent.com/ga4gh-discovery/ga4gh-service-info/v1.0.0/service-info.yaml#/components/schemas/Service
htsgetServiceInfo:
allOf:
- '$ref': '#/components/schemas/ServiceInfo'
- type: object
properties:
htsget:
type: object
description: extended attributes for htsget
properties:
datatype:
type: string
description: >
Indicates the htsget datatype category ('reads' or 'variants')
served by the ticket endpoint related to this service-info
endpoint
enum: [reads, variants]
example: reads
formats:
type: array
description: >
List of alignment or variant file formats supported
by the htsget endpoint. If absent, clients cannot make
assumptions about what formats are supported ahead
of making a query.
items:
type: string
enum: [BAM, CRAM, VCF, BCF]
fieldsParameterEffective:
type: boolean
description: >
Indicates whether the web service supports alignment field
inclusion/exclusion via the `fields` parameter. If absent,
clients cannot make assumptions about whether the `fields`
parameter is effective ahead of making a query.
tagsParametersEffective:
type: boolean
description: >
Indicates whether the web service supports alignment tag
inclusion/exclusion via the `tags` and `notags` parameters.
If absent, clients cannot make assumptions about whether the
`tags` and `notags` parameters are effective ahead of making
a query.
- type: object
description: >
This response extends the GA4GH Service Info specification
with htsget-specific properties under the 'htsget' attribute.
ServiceType 'artifact' property MUST be 'htsget' for both reads
and variants endpoints.
required:
- type
properties:
type:
type: object
required:
- artifact
properties:
artifact:
type: string
enum: [htsget]
example: htsget
Error:
type: object
description: Generic error response object
required:
- htsget
properties:
htsget:
type: object
description: Container for the error response object
required:
- error
- message
properties:
error:
type: string
description: The type of error
message:
type: string
description: A message specific to the error providing information on how to debug the problem. Clients MAY display this message to the user.
InvalidAuthenticationError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: Authorization provided is invalid
properties:
htsget:
properties:
error:
example: InvalidAuthentication
message:
example: Invalid authentication credentials provided
PermissionDeniedError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: Authorization is required to access the resource
properties:
htsget:
properties:
error:
example: PermissionDenied
message:
example: Client is not authorized to access this resource
NotFoundError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: The resource requested was not found
properties:
htsget:
properties:
error:
example: NotFound
message:
example: The requested resource could not be found
UnsupportedFormatError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: The requested file format is not supported by the server
properties:
htsget:
properties:
error:
example: UnsupportedFormat
message:
example: The requested file format is not supported by the server
InvalidInputError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: The request parameters do not adhere to the specification
properties:
htsget:
properties:
error:
example: InvalidInput
message:
example: The request parameters do not adhere to the specification
InvalidRangeError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: The requested range cannot be satisfied
properties:
htsget:
properties:
error:
example: InvalidRange
message:
example: The requested range cannot be satisfied
PayloadTooLargeError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: POST request size is too large
properties:
htsget:
properties:
error:
example: PayloadTooLarge
message:
example: POST request size is too large
InternalServerError:
allOf:
- $ref: '#/components/schemas/Error'
- type: object
description: Internal server error
properties:
htsget:
properties:
error:
example: InternalServerError
message:
example: An internal server error occurred
parameters:
idPathParam:
in: path
name: id
description: read or variant object identifier
required: true
schema:
type: string
classParam:
in: query
name: class
required: false
schema:
$ref: '#/components/schemas/Class'
referenceNameParam:
in: query
name: referenceName
required: false
schema:
$ref: '#/components/schemas/ReferenceName'
startParam:
in: query
name: start
required: false
schema:
$ref: '#/components/schemas/Start'
endParam:
in: query
name: end
required: false
schema:
$ref: '#/components/schemas/End'
securitySchemes:
htsget_auth:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://example.com/api/oauth/dialog
tokenUrl: https://example.com/api/oauth/token
scopes:
read:genomic_reads: read access to genomic reads
read:genomic_variants: read access to genomic variants
responses:
400BadRequestResponse:
description: Bad request
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/UnsupportedFormatError'
- $ref: '#/components/schemas/InvalidInputError'
- $ref: '#/components/schemas/InvalidRangeError'
401UnauthorizedResponse:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/InvalidAuthenticationError'
403ForbiddenResponse:
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/PermissionDeniedError'
404NotFoundResponse:
description: NotFound
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundError'
413PayloadTooLargeResponse:
description: PayloadTooLarge
content:
application/json:
schema:
$ref: '#/components/schemas/PayloadTooLargeError'
500InternalServerErrorResponse:
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/InternalServerError'