Skip to content

Commit a3b1c82

Browse files
authored
Merge pull request #16 from CanDIG/daisieh/run
DIG-2067: Run schema
2 parents b05ea8c + 22aec20 commit a3b1c82

File tree

2 files changed

+89
-9
lines changed

2 files changed

+89
-9
lines changed

drs_server/drs_database.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ def delete_program(program_id, tries=1):
372372

373373
def list_biosamples(program_ids=None, submitter_sample_ids=None):
374374
experiment_obj = aliased(DrsObject)
375-
analysis_obj = aliased(DrsObject)
376-
stmt = select(experiment_obj.name, experiment_obj.id, experiment_obj.program_id, experiment_obj.description, analysis_obj.name, analysis_obj.description, ContentsObject)
375+
related_obj = aliased(DrsObject)
376+
stmt = select(experiment_obj.name, experiment_obj.id, experiment_obj.program_id, experiment_obj.description, related_obj.id, related_obj.description, ContentsObject)
377377
stmt = stmt.join(experiment_obj, ContentsObject.drs_object_id == experiment_obj.id)
378-
stmt = stmt.join(analysis_obj, ContentsObject.contents_id == analysis_obj.name)
378+
stmt = stmt.join(related_obj, ContentsObject.contents_id == related_obj.id)
379379
stmt = stmt.filter(experiment_obj.description.in_(['wgs', 'wts']))
380380

381381
if program_ids is not None:
@@ -400,10 +400,10 @@ def list_biosamples(program_ids=None, submitter_sample_ids=None):
400400
if result["description"] in ["wgs", "wts"] and result["id"] not in results_dict[result["name"]]["experiments"][result["description"]]:
401401
results_dict[result["name"]]["experiments"][result["description"]].append(result["id"])
402402
if result["description_1"] == "raw_reads":
403-
results_dict[result["name"]]["runs"].append(result["name_1"])
403+
results_dict[result["name"]]["runs"].append(result["id_1"])
404404
else:
405405
if result["description_1"] not in results_dict[result["name"]]["analyses"]:
406406
results_dict[result["name"]]["analyses"][result["description_1"]] = []
407-
results_dict[result["name"]]["analyses"][result["description_1"]].append(result["name_1"])
407+
results_dict[result["name"]]["analyses"][result["description_1"]].append(result["id_1"])
408408
return list(results_dict.values())
409409
return None

drs_server/drs_openapi.yaml

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ paths:
4646
items:
4747
anyOf:
4848
- $ref: '#/components/schemas/ExperimentDrsObject'
49+
- $ref: '#/components/schemas/RunDrsObject'
4950
- $ref: '#/components/schemas/AnalysisDrsObject'
5051
- $ref: '#/components/schemas/DataDrsObject'
5152
tags:
@@ -92,7 +93,10 @@ paths:
9293
application/json:
9394
schema:
9495
oneOf:
96+
- $ref: '#/components/schemas/ExperimentDrsObject'
97+
- $ref: '#/components/schemas/RunDrsObject'
9598
- $ref: '#/components/schemas/AnalysisDrsObject'
99+
- $ref: '#/components/schemas/DataDrsObject'
96100
tags:
97101
- Objects
98102
/objects/{object_id}/download:
@@ -306,9 +310,10 @@ components:
306310
'application/json':
307311
schema:
308312
anyOf:
309-
- $ref: "#/components/schemas/ExperimentDrsObject"
310-
- $ref: "#/components/schemas/AnalysisDrsObject"
311-
- $ref: "#/components/schemas/DataDrsObject"
313+
- $ref: '#/components/schemas/ExperimentDrsObject'
314+
- $ref: '#/components/schemas/RunDrsObject'
315+
- $ref: '#/components/schemas/AnalysisDrsObject'
316+
- $ref: '#/components/schemas/DataDrsObject'
312317
ProgramRequest:
313318
content:
314319
'application/json':
@@ -490,6 +495,81 @@ components:
490495
# minItems: 1
491496
items:
492497
$ref: '#/components/schemas/Checksum'
498+
RunDrsObject:
499+
type: object
500+
description: A DrsObject that describes the raw read files.
501+
required:
502+
- name
503+
- id
504+
- contents
505+
- description
506+
- program
507+
properties:
508+
name:
509+
type: string
510+
description: The experiment's name that this run is generated from.
511+
id:
512+
type: string
513+
description: The unique ID for the run.
514+
contents:
515+
type: array
516+
description: The specific raw FASTQ files that were generated in this Run.
517+
items:
518+
$ref: '#/components/schemas/ContentsObject'
519+
description:
520+
type: string
521+
description: For a Run object, the description should be `raw_reads`
522+
enum:
523+
- raw_reads
524+
program:
525+
type: string
526+
description: The program this object was ingested as part of
527+
self_uri:
528+
type: string
529+
description: |-
530+
A drs:// hostname-based URI, as defined in the DRS documentation, that tells clients how to access this object.
531+
The intent of this field is to make DRS objects self-contained, and therefore easier for clients to store and pass around. For example, if you arrive at this DRS JSON by resolving a compact identifier-based DRS URI, the `self_uri` presents you with a hostname and properly encoded DRS ID for use in subsequent `access` endpoint calls.
532+
example:
533+
drs://drs.example.org/314159
534+
aliases:
535+
type: array
536+
items:
537+
type: string
538+
description: >-
539+
A list of strings that can be used to find other metadata
540+
about this `DrsObject` from external metadata sources. These
541+
aliases can be used to represent secondary
542+
accession numbers or external GUIDs.
543+
metadata:
544+
type: object
545+
description: metadata about the run (see Run in ingest_openapi.yaml)
546+
size:
547+
type: integer
548+
format: int64
549+
description: The cumulative size, in bytes, of items in the `contents` field.
550+
created_time:
551+
type: string
552+
format: date-time
553+
description: |-
554+
Timestamp of content creation in RFC3339.
555+
(This is the creation time of the underlying content, not of the JSON object.)
556+
updated_time:
557+
type: string
558+
format: date-time
559+
description: >-
560+
Timestamp of content update in RFC3339, identical to `created_time` in systems
561+
that do not support updates.
562+
(This is the update time of the underlying content, not of the JSON object.)
563+
version:
564+
type: string
565+
description: >-
566+
A string representing a version.
567+
(Some systems may use checksum, a RFC3339 timestamp, or an incrementing version number.)
568+
checksums:
569+
type: array
570+
# minItems: 1
571+
items:
572+
$ref: '#/components/schemas/Checksum'
493573
AnalysisDrsObject:
494574
type: object
495575
description: A DrsObject that describes a sequencing analysis. It usually will consist of a data file, e.g. a variant or read file, and its associated index file. Its contents should also include any associated Experiments (as ContentObjects), ordered in order of appearance in the associated variant/read files.
@@ -590,7 +670,7 @@ components:
590670
properties:
591671
name:
592672
type: string
593-
description: Unique ID for this data object
673+
description: The filename for this data file, including its file extensions.
594674
id:
595675
type: string
596676
description: The filename for this data file, including its file extensions.

0 commit comments

Comments
 (0)