The global and node parameters are validated against a JSON schema. Also the parameters are edited in a form generated from the JSON schema.
The schema should formatted according to the JSON schema draft 7 specification.
Besides the keywords and formats defined in the specification and in ajv-formats, the workflow builder adds the following:
The maxItemsFrom
keyword can be used to limit the number of items in an array defined in a schema of a node by the same number of items in a global parameter.
For example to make the maxItems
of the nprop
property in the node schema have the same as the length of the global parameter named gprop
use the following catalog.
title: Test catalog
global:
uiSchema: {}
tomlSchema: {}
schema:
type: object
properties:
gprop:
type: array
items:
type: string
categories:
- name: cat1
description: Category 1
nodes:
- id: node1
category: cat1
uiSchema: {}
tomlSchema: {}
schema:
type: object
properties:
nprop:
type: array
items:
type: string
maxItemsFrom: gprop
When global parameters looks like
{
"gprop": ["a", "b"]
}
Then the schema used for validation and form generation of the node will be
{
"type": "object",
"properties": {
"nprop": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 2
}
}
}
The maxItemsFrom
keyword only works when the property is of type array and the global parameter is also an array.
To restrict the residues sequence numbers or to restrict the possible chains. You can use the residue
and chain
formats.
To compute the valid residues sequence numbers of a property the builder needs to know which PDB file that belongs to that property. This is done by annotating the parent array property with maxItemsFrom: <global parameter name which holds molecule paths>
and annotating that global parameter with format: moleculefilepaths
.
For example a schema of a node
type: object
properties:
seg:
type: array
maxItemsFrom: molecules
title: Segments
items:
type: array
title: Segments of a molecule
items:
type: object
properties:
chain:
title: Chain
type: string
format: chain
sta:
title: Starting residue number
type: number
format: residue
end:
title: Ending residue number
type: number
format: residue
and a global schema
type: object
properties:
molecules:
title: Input Molecules
type: array
format: moleculefilepaths
items:
type: string
format: uri-reference
and a PDB file was uploaded to the global parameters
{
"molecules": ["abcd.pdb"]
}
and abcd.pdb
file has chain A and B with residues 1, 2, 3 and 4.
Then the form will have restricted the chain
prop to only allow A
and B
and will have restricted the sta and end prop to only allow 1, 2, 3 and 4.
To have a string property that should be restricted to any chains in any of the uploaded PDB files, for node schema use something like
type: object
properties:
receptor_chain:
type: string
format: chain
For example if 2 pdb files with chain A, B and C are uploaded, the form will restrict the receptor_chain property to only allow A, B and C. The restriction is only applied if all the PDB files could be parsed.
The if
, then
and else
keywords can be used to conditionally apply a schema.
For example to have the foo
property only if the bar
property is false use:
type: object
additionalProperties: true
properties:
bar:
type: boolean
if:
properties:
bar:
const: true
then: {}
else:
properties:
foo:
type: string
Only supports simple const condition with one or more properties and not complex conditions like patterns. Also only a single if/tnen/else block per object is supported. It can be combined with groups.
Also only supported with additionalProperties: true
present in the schema.