Skip to content

Commit

Permalink
Merge pull request #655 from kids-first/bix-enums
Browse files Browse the repository at this point in the history
✨ Modify GenomicFile release_status, data_type enums
  • Loading branch information
znatty22 authored Apr 12, 2024
2 parents 40a4a7a + 3d4d8c0 commit 8462709
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
29 changes: 28 additions & 1 deletion dataservice/api/genomic_file/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,24 @@
"Variant Calling Metrics",
"Variant Summary",
"WGS Metric",
"WXS Metric"}
"WXS Metric",
"Adapter Stats",
"Alignment Metrics",
"Alignment Stats",
"Artifact Metrics",
"Chimeric Aligned Reads",
"Cutadapter Metrics",
"GC Metrics",
"Gender Metrics",
"Gender QC Metrics",
"Genome Aligned Reads",
"Genome Aligned Reads Index",
"Het Call QC Metrics",
"Insert Size Metrics",
"QC Metrics",
"WGS Metrics",
"WXS Metrics",
}

PAIRED_END_ENUM = {1, 2}

Expand All @@ -145,6 +162,12 @@
"Somatic-Mutation",
}

RELEASE_STATUS_ENUM = {
"latest",
"previous",
"unharmonized",
}


class GenomicFileSchema(BaseSchema, IndexdFileSchema):
class Meta(BaseSchema.Meta, IndexdFileSchema.Meta):
Expand Down Expand Up @@ -178,6 +201,10 @@ class Meta(BaseSchema.Meta, IndexdFileSchema.Meta):
GenomicFile, 'workflow_type',
validate=enum_validation_generator(WORKFLOW_TYPE_ENUM)
)
release_status = field_for(
GenomicFile, 'release_status',
validate=enum_validation_generator(RELEASE_STATUS_ENUM)
)

_links = ma.Hyperlinks({
'self': ma.URLFor(Meta.resource_url, kf_id='<kf_id>'),
Expand Down
8 changes: 5 additions & 3 deletions tests/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"workflow_type": "Alignment",
"workflow_tool": "tool",
"workflow_version": "v1",
"release_status": "released",
"release_status": "latest",
"data_category": "foo",
"visible": true
},
Expand Down Expand Up @@ -281,15 +281,17 @@
"controlled_access": true,
"paired_end": 1,
"data_type": "Expression",
"workflow_type": "Alignment"
"workflow_type": "Alignment",
"release_status": "latest"
},
"invalid": [
{ "paired_end": -1 },
{ "paired_end": "one" },
{ "controlled_access": "hello", "size": "hello" },
{ "availability": "availble for download" },
{ "data_type": "read" },
{ "workflow_type": "foo" }
{ "workflow_type": "foo" },
{ "release_status": "foo" }
]
},
"/biospecimen-genomic-files": {
Expand Down

0 comments on commit 8462709

Please sign in to comment.