diff --git a/htsget_server/htsget_openapi.yaml b/htsget_server/htsget_openapi.yaml index 4fc624b1..96f943c1 100644 --- a/htsget_server/htsget_openapi.yaml +++ b/htsget_server/htsget_openapi.yaml @@ -865,6 +865,17 @@ components: description: An array of associated GenomicDrsObjects that describe transcriptome data. items: type: string + variants: + type: array + description: An array of associated GenomicDataDrsObjects that describe variant files. + items: + type: string + reads: + type: array + description: An array of associated GenomicDataDrsObjects that describe read files. + items: + type: string + # ERROR SCHEMAS Error: diff --git a/htsget_server/htsget_operations.py b/htsget_server/htsget_operations.py index 2e2b6a68..6de864b0 100644 --- a/htsget_server/htsget_operations.py +++ b/htsget_server/htsget_operations.py @@ -238,7 +238,9 @@ def get_sample(id_=None): result = { "sample_id": id_, "genomes": [], - "transcriptomes": [] + "transcriptomes": [], + "variants": [], + "reads": [] } # Get the SampleDrsObject. It will have a contents array of GenomicContentsObjects > GenomicDrsObjects. @@ -252,6 +254,13 @@ def get_sample(id_=None): result["genomes"].append(drs_obj["id"]) elif drs_obj["description"] == "wts": result["transcriptomes"].append(drs_obj["id"]) + # check the contents of this genomic drs object and see if it contains variants or reads + if "contents" in drs_obj: + for content in drs_obj["contents"]: + if content["id"] == "variant": + result["variants"].append(drs_obj["id"]) + elif content["id"] == "read": + result["reads"].append(drs_obj["id"]) return result, 200 return {"message": f"Could not find sample {id_}"}, 404