Add schema def for unaligned sequences - #2037
Conversation
Some workflows use unaligned sequences as input to augur subsample. In this case, proximal samples will not work properly. This schema def makes it easier for workflows to guard against configs with proximal samples.
9c16031 to
fc86867
Compare
| "allOf": [ | ||
| {"$ref": "#"}, | ||
| { | ||
| "properties": { | ||
| "samples": { | ||
| "patternProperties": { | ||
| "^.+$": {"$ref": "#/$defs/filterSampleProperties"} | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] |
There was a problem hiding this comment.
I wasn't sure how allOf works here, so I just tested a couple configs.
Looks like this works as expected if just trying to use a proximalSampleProperties
Validating schema of 'results/run_config.yaml'...
.subsample.'a/genome/6y'.samples.background failed: Unexpected property 'focal_sample'
ERROR: Validation of 'results/run_config.yaml' failed.
There's an edge case where I mix filterSampleProperties and proximalSampleProperties, then I get an error message that suggests proximalSampleProperties are accepted
Validating schema of 'results/run_config.yaml'...
.subsample.'a/genome/6y'.samples.background failed: {"group_by": ["year", "country"], "focal_sample"…} did not match one of the acceptable options below.
Option 1: {"$ref": "#/$defs/filterSampleProperties"}
.subsample.'a/genome/6y'.samples.background failed: Unexpected property 'focal_sample'
Option 2: {"$ref": "#/$defs/proximalSampleProperties"}
.subsample.'a/genome/6y'.samples.background failed: Unexpected property 'group_by'
.subsample.'a/genome/6y'.samples.background failed: Unexpected property 'focal_sample'
ERROR: Validation of 'results/run_config.yaml' failed.
I'm not sure there's a way to work around this since JSON schema doesn't really support overriding subschemas.
There was a problem hiding this comment.
Currently the schema defaults to allowing proximal samples. We could flip it around and make it opt-in such that nextstrain/rsv#103 references https://nextstrain.org/schemas/augur/subsample-config/v1, while measles references https://nextstrain.org/schemas/augur/subsample-config/v1#/$defs/schemaForAlignedSequences. This would work better with allOf since it's additive.
There was a problem hiding this comment.
Hmm, based on allOf docs, flipping it around won't work either
allOf can not be used to "extend" a schema to add more details to it in the sense of object-oriented inheritance. Instances must independently be valid against "all of" the schemas in the allOf. See the section on Extending Closed Schemas for more information.
There was a problem hiding this comment.
e19abfa works:
Validating schema of 'results/run_config.yaml'...
.subsample.'a/genome/all-time'.samples.sample failed: Unexpected property 'focal_sample'
ERROR: Validation of 'results/run_config.yaml' failed.
But validation is also done at augur subsample run time. If proximal samples are opt-in, we'd need to make it explicit using something like --aligned-sequences instead of --sequences...
Description of proposed changes
Some workflows use unaligned sequences as input to augur subsample. In this case, proximal samples will not work properly. This schema def makes it easier for workflows to guard against configs with proximal samples.
Related issue(s)
nextstrain/rsv#103 (comment)
Checklist