Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make node schema maxItemsFrom and molecule aware #62

Merged
merged 50 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b3e63f9
Merge remote-tracking branch 'origin/prune-defaults-with-placeholders…
sverhoeven Apr 5, 2022
cf67d8a
Add catalog to test molecule aware parameters, starting with most simple
sverhoeven Apr 5, 2022
dd5cca6
Implement resolveMaxItemsFrom
sverhoeven Apr 5, 2022
4e51bda
Add dummy validation method for custom format so ajv warnings are sil…
sverhoeven Apr 6, 2022
35d6b43
Upgrade vitest
sverhoeven Apr 6, 2022
9a72e6e
Resolve maxItemsFrom in node schema when validating a uploaded workflow
sverhoeven Apr 6, 2022
bbad03c
Document maxItemsFrom JSON schema keyword
sverhoeven Apr 6, 2022
002624f
Move molecule formats to own module + define maxItemsFrom keyword acc…
sverhoeven Apr 6, 2022
85ecfca
Added simple PDB parser
sverhoeven Apr 6, 2022
892afce
Added dataURL2content()
sverhoeven Apr 6, 2022
1b81d27
Rename Pdb type to MoleculeInfo
sverhoeven Apr 6, 2022
3fb9272
Started with code that can fill enum for chains format
sverhoeven Apr 6, 2022
560fb33
array>array>object>scalar[format=moleculeformat]
sverhoeven Apr 8, 2022
1357eb2
implement dataURL2content test
sverhoeven Apr 11, 2022
d6f3887
Narrow return type
sverhoeven Apr 11, 2022
6ed008f
Implement format:residue + more tests
sverhoeven Apr 11, 2022
e859fb8
Add molecule validation to schema for node form
sverhoeven Apr 11, 2022
5a9d616
Add node to molaware catalog that adds enums to chain and residue for…
sverhoeven Apr 11, 2022
ea61f2d
Document Format moleculefilepaths, chain and residue
sverhoeven Apr 11, 2022
9247dd7
Added test for topoaa.mol prop
sverhoeven Apr 11, 2022
1ffcd30
Handle array>object>array>scalar[format=moleculeformat] shape
sverhoeven Apr 11, 2022
14dadfb
Add types for ws package
sverhoeven Apr 11, 2022
ad912fb
Added format:moleculepaths and maxItemsFrom:molecules + regenerate ca…
sverhoeven Apr 22, 2022
84fad18
Added format:chain and format:residue to catalog
sverhoeven Apr 22, 2022
ae7feed
Typo
sverhoeven Apr 22, 2022
67d64bf
Merge remote-tracking branch 'origin/main' into maxItemsFrom-aware
sverhoeven Apr 22, 2022
307191f
Formatting + move molaware catalog down
sverhoeven Apr 22, 2022
23dd982
Why alwaysTrue?
sverhoeven Apr 22, 2022
f8f210d
Add note how format:chain/residue are inferred from defaults.yaml
sverhoeven Apr 25, 2022
8bca839
Validate format:chain when uploading a workflow archive
sverhoeven Apr 25, 2022
a4c7027
Pass files arg in right place
sverhoeven Apr 25, 2022
35479dd
Also parse HETATM
sverhoeven Apr 26, 2022
f9a50b1
Make linter happy
sverhoeven May 4, 2022
545f614
Merge remote-tracking branch 'origin/main' into maxItemsFrom-aware
sverhoeven May 17, 2022
dafa94e
Update docs/schema.md
sverhoeven May 17, 2022
ad9750d
Give more feedback when upload fails.
sverhoeven May 17, 2022
17992f8
Revert "Give more feedback when upload fails."
sverhoeven May 17, 2022
eef33eb
Merge branch 'maxItemsFrom-aware' of github.com:i-VRESSE/workflow-bui…
sverhoeven May 17, 2022
ba94e38
Workaround for `['ab initio mode'].rair[0] should be array` validatio…
sverhoeven May 20, 2022
aba893a
Merge remote-tracking branch 'origin/main' into maxItemsFrom-aware
sverhoeven May 20, 2022
a66faf7
Lint fix
sverhoeven May 20, 2022
00a3ef7
Force install of only v17 of @types/react
sverhoeven May 20, 2022
63c906f
Added integration test functionality using playwright
sverhoeven May 20, 2022
3c4feea
Exclude .yarn from git
sverhoeven May 24, 2022
1be9193
Make linter, vitest and playwright co-exist together
sverhoeven May 30, 2022
19db0c4
Added integration test for removing molecule + group tests better
sverhoeven May 30, 2022
10d2e59
Configure reporter for integration tests
sverhoeven May 30, 2022
8ad2f56
styling
sverhoeven May 30, 2022
87731ba
Ignore more files
sverhoeven May 30, 2022
8587a87
Move + button to header
sverhoeven May 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ jobs:
- run: yarn test
- run: yarn lint
- run: yarn build
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run integration tests
run: yarn test:integration
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dist
dist-ssr
*.local
coverage
.coverage
util/__pycache__/
.yarn
playwright-report/
.vscode/
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The main branch is published at https://wonderful-noether-53a9e8.netlify.app/

## Develop

Requires [NodeJS](https://nodejs.org/) and [yarn](https://yarnpkg.com/).
Requires [NodeJS](https://nodejs.org/) and [yarn](https://yarnpkg.com/) (tested with v3.2.1).

```shell
# Install dependencies
Expand All @@ -20,7 +20,7 @@ yarn dev
# Goto http://localhost:3000
```

### Tests
### Unit tests

Tests (**/*.test.tsx?) written in [vitetest](https://vitest.dev/) (a test framework similar to [jest](https://jestjs.io/)) can be run with:

Expand All @@ -36,6 +36,32 @@ yarn test run --coverage

Creates `coverage/` directory with HTML and LCOV report.

### Integration tests

The integration tests (`integration-tests/**.spec.ts`) are written in [playwright](https://playwright.dev/).

Before running test ensure browsers are installed with

```shell
npx playwright install
```

Tests can be run with

```shell
yarn test:integration
```

To run in a non-headless browser use

```shell
yarn test:integration --headed
```

The browser will pause when a test calls `await page.pause()`, so you can investigate current state.

There is a VS code extension to run integration tests inside editor.

### Linting

```shell
Expand Down Expand Up @@ -113,6 +139,10 @@ The catalog is a YAML formatted file which tells the app what nodes are availabl
* map with title as key and link as value
5. title: Title of the catalog

### schema

See [docs/schema.md](docs/schema.md).

#### uiSchema

See [docs/uiSchema.md](docs/uiSchema.md).
Expand Down
133 changes: 133 additions & 0 deletions docs/schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Schema

The global and node parameters are validated against a [JSON schema](https://json-schema.org/).
Also the parameters are edited in a form generated from the JSON schema.

The schema should formatted according to the [JSON schema draft 7](https://json-schema.org/specification-links.html#draft-7) specification.

Besides the keywords and formats defined in the specification and in [ajv-formats](https://github.com/ajv-validator/ajv-formats), the workflow builder adds the following:

## Keyword maxItemsFrom

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.

```yaml
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

```json
{
"gprop": ["a", "b"]
}
```

Then the schema used for validation and form generation of the node will be

```json
{
"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.

## Format moleculefilepaths, chain and residue

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

```yaml
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

```yaml
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

```json
{
"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.
2 changes: 2 additions & 0 deletions integration-tests/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory is a copy of https://github.com/haddocking/haddock3/tree/main/examples/docking-protein-protein/data
and is used in the integration tests.
Loading