From 976da5580c90d9925e86239e0d4ba1313f178ff0 Mon Sep 17 00:00:00 2001 From: Ronak Shah Date: Fri, 4 Oct 2024 00:32:25 -0400 Subject: [PATCH 1/5] Update test.yml Update for new modules schema --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41c854e1..ae0f84b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -182,8 +182,8 @@ jobs: python-version: "3.10" - name: Download convertor from yml to md run: | - curl -o ${{ github.workspace }}/yaml_to_md.py https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/yaml_to_md.py - curl -o ${{ github.workspace }}/requirements.txt https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/requirements.txt + curl -o ${{ github.workspace }}/yaml_to_md.py https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/yaml_to_md.py + curl -o ${{ github.workspace }}/requirements.txt https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/requirements.txt - name: Give convertor permissions run: chmod +x yaml_to_md.py - name: Install python packages @@ -227,7 +227,7 @@ jobs: run: | echo ${{ matrix.tags }} echo ${{ env.FEATURE_TYPE }} - python ${{ github.workspace }}/yaml_to_md.py validate --yaml-file ${{ github.workspace }}/temp.yml --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json + python ${{ github.workspace }}/yaml_to_md.py validate --yaml-file ${{ github.workspace }}/temp.yml --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json pytest: runs-on: ubuntu-latest From 25fbc39c855706c9d1d51d4d5dc2797d3d91b71c Mon Sep 17 00:00:00 2001 From: huyu335 <51341407+huyu335@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:41:34 -0400 Subject: [PATCH 2/5] Update yaml to md --- .github/workflows/gitbook-sync.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gitbook-sync.yml b/.github/workflows/gitbook-sync.yml index f81022be..ae138e16 100644 --- a/.github/workflows/gitbook-sync.yml +++ b/.github/workflows/gitbook-sync.yml @@ -101,8 +101,8 @@ jobs: echo "${MD_NAME}" - name: Download convertor from yml to md run: | - curl -o ${{ github.workspace }}/yaml_to_md.py https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/yaml_to_md.py - curl -o ${{ github.workspace }}/requirements.txt https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/requirements.txt + curl -o ${{ github.workspace }}/yaml_to_md.py https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/yaml_to_md.py + curl -o ${{ github.workspace }}/requirements.txt https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/requirements.txt - name: Give convertor permissions run: chmod +x yaml_to_md.py - name: Install python packages From e7b0a473bacfb1f8c441c46c7af0b524a683be76 Mon Sep 17 00:00:00 2001 From: huyu335 <51341407+huyu335@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:43:07 -0400 Subject: [PATCH 3/5] Missed one place --- .github/workflows/gitbook-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitbook-sync.yml b/.github/workflows/gitbook-sync.yml index ae138e16..95eae369 100644 --- a/.github/workflows/gitbook-sync.yml +++ b/.github/workflows/gitbook-sync.yml @@ -147,7 +147,7 @@ jobs: - name: Run convertor to generate md file for new module run: | echo ${{ matrix.tags }} - python ${{ github.workspace }}/yaml_to_md.py all --yaml-file ${{ github.workspace }}/temp.yml --output-file ./${{ env.FEATURE_TYPE }}/${{ env.MD_NAME }}.md --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.1/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json ${{ env.SUBWORKFLOW }} + python ${{ github.workspace }}/yaml_to_md.py all --yaml-file ${{ github.workspace }}/temp.yml --output-file ./${{ env.FEATURE_TYPE }}/${{ env.MD_NAME }}.md --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.2/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json ${{ env.SUBWORKFLOW }} - name: Check file existence for modules id: check_files uses: andstor/file-existence-action@v1 From 5dc3d2755e5d939252689d736f3cfcc22a047483 Mon Sep 17 00:00:00 2001 From: Yu Hu Date: Fri, 4 Oct 2024 11:42:03 -0400 Subject: [PATCH 4/5] update json schemas --- modules/environment-schema.json | 40 +++++--- modules/meta-schema.json | 172 ++++++++++++-------------------- subworkflows/yaml-schema.json | 33 +----- 3 files changed, 94 insertions(+), 151 deletions(-) diff --git a/modules/environment-schema.json b/modules/environment-schema.json index 0aedb819..cf0d0981 100644 --- a/modules/environment-schema.json +++ b/modules/environment-schema.json @@ -4,29 +4,39 @@ "description": "Validate the environment.yml file for an nf-core module", "type": "object", "properties": { - "name": { - "type": "string", - "description": "The name of the component, same as in the meta.yml" - }, "channels": { "type": "array", - "items": [ - { - "enum": ["conda-forge"] - }, - { - "enum": ["bioconda"] - } - ], + "items": { + "enum": ["bioconda", "conda-forge"] + }, "minItems": 2 }, "dependencies": { "type": "array", "items": { - "type": "string", - "pattern": "^.[^><]=[^><].$" + "oneOf": [ + { + "type": "string", + "pattern": "^.*[^><]=[^><].*$", + "$comment": "The above pattern ensures that all packages are pinned to a specific version. This ensures the reproducibility of the environment" + }, + { + "type": "object", + "properties": { + "pip": { + "type": "array", + "items": { + "type": "string", + "pattern": "^.*==.*$", + "$comment": "The above pattern ensures that all packages are pinned to a specific version. This ensures the reproducibility of the environment" + } + } + } + } + ] } } }, - "required": ["channels", "dependencies"] + "required": ["channels", "dependencies"], + "not": { "required": ["name"] } } diff --git a/modules/meta-schema.json b/modules/meta-schema.json index d732a552..977ee1b6 100644 --- a/modules/meta-schema.json +++ b/modules/meta-schema.json @@ -38,61 +38,8 @@ "type": "array", "description": "Input channels for the module", "items": { - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Type of the input channel", - "enum": [ - "map", - "file", - "directory", - "string", - "integer", - "float", - "boolean", - "list" - ] - }, - "description": { - "type": "string", - "description": "Description of the input channel" - }, - "pattern": { - "type": "string", - "description": "Pattern of the input channel, given in Java glob syntax" - }, - "default": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ], - "description": "Default value for the input channel" - }, - "enum": { - "type": "array", - "description": "List of allowed values for the input channel", - "items": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ] - }, - "uniqueItems": true - } - }, - "required": ["type", "description"] - } - } + "type": "array", + "items": { "$ref": "#/definitions/elementProperties" } } }, "output": { @@ -100,50 +47,7 @@ "description": "Output channels for the module", "items": { "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Type of the output channel", - "enum": [ - "map", - "file", - "directory", - "string", - "integer", - "float", - "boolean", - "list" - ] - }, - "description": { - "type": "string", - "description": "Description of the output channel" - }, - "pattern": { - "type": "string", - "description": "Pattern of the input channel, given in Java glob syntax" - }, - "enum": { - "type": "array", - "description": "List of allowed values for the output channel", - "items": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ] - }, - "uniqueItems": true - } - }, - "required": ["type", "description"] - } - } + "items": { "$ref": "#/definitions/elementProperties" } } }, "tools": { @@ -196,6 +100,19 @@ "minItems": 1, "uniqueItems": true, "message": "Licence must be an array of one or more entries, e.g. [\"MIT\"]" + }, + "identifier": { + "description": "bio.tools identifier of the tool", + "anyOf": [ + { + "type": "string", + "pattern": "^biotools:.*$" + }, + { + "type": "string", + "maxLength": 0 + } + ] } }, "required": ["description"], @@ -218,12 +135,53 @@ } } }, - "required": [ - "name", - "description", - "keywords", - "authors", - "output", - "tools" - ] + "definitions": { + "elementProperties": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of the channel element", + "enum": ["map", "file", "directory", "string", "integer", "float", "boolean", "list"] + }, + "description": { + "type": "string", + "description": "Description of the channel" + }, + "pattern": { + "type": "string", + "description": "Pattern of the channel, given in Java glob syntax" + }, + "enum": { + "type": "array", + "description": "List of allowed values for the channel", + "items": { + "type": ["string", "number", "boolean", "array", "object"] + }, + "uniqueItems": true + }, + "ontologies": { + "type": "array", + "description": "List of ontologies for the channel", + "uniqueItems": true, + "items": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string", + "pattern": "^(http|https)://.*" + } + } + } + } + }, + "required": ["type", "description"] + } + } + } + }, + "required": ["name", "description", "keywords", "authors", "output", "tools"] } diff --git a/subworkflows/yaml-schema.json b/subworkflows/yaml-schema.json index 295ed88d..25adc0cc 100644 --- a/subworkflows/yaml-schema.json +++ b/subworkflows/yaml-schema.json @@ -64,26 +64,14 @@ "description": "Pattern of the input channel, given in Java glob syntax" }, "default": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ], + "type": ["string", "number", "boolean", "array", "object"], "description": "Default value for the input channel" }, "enum": { "type": "array", "description": "List of allowed values for the input channel", "items": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ] + "type": ["string", "number", "boolean", "array", "object"] }, "uniqueItems": true } @@ -118,13 +106,7 @@ "type": "array", "description": "List of allowed values for the output channel", "items": { - "type": [ - "string", - "number", - "boolean", - "array", - "object" - ] + "type": ["string", "number", "boolean", "array", "object"] }, "uniqueItems": true } @@ -135,12 +117,5 @@ } } }, - "required": [ - "name", - "description", - "keywords", - "authors", - "output", - "components" - ] + "required": ["name", "description", "keywords", "authors", "output", "components"] } From cb7b2d99b81aaa40007dab64cb123c94a1697b11 Mon Sep 17 00:00:00 2001 From: Yu Hu Date: Fri, 4 Oct 2024 11:46:31 -0400 Subject: [PATCH 5/5] reformat --- modules/meta-schema.json | 28 +++++++++++++++++++++++++--- subworkflows/yaml-schema.json | 33 +++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/modules/meta-schema.json b/modules/meta-schema.json index 977ee1b6..8542ee61 100644 --- a/modules/meta-schema.json +++ b/modules/meta-schema.json @@ -145,7 +145,16 @@ "type": { "type": "string", "description": "Type of the channel element", - "enum": ["map", "file", "directory", "string", "integer", "float", "boolean", "list"] + "enum": [ + "map", + "file", + "directory", + "string", + "integer", + "float", + "boolean", + "list" + ] }, "description": { "type": "string", @@ -159,7 +168,13 @@ "type": "array", "description": "List of allowed values for the channel", "items": { - "type": ["string", "number", "boolean", "array", "object"] + "type": [ + "string", + "number", + "boolean", + "array", + "object" + ] }, "uniqueItems": true }, @@ -183,5 +198,12 @@ } } }, - "required": ["name", "description", "keywords", "authors", "output", "tools"] + "required": [ + "name", + "description", + "keywords", + "authors", + "output", + "tools" + ] } diff --git a/subworkflows/yaml-schema.json b/subworkflows/yaml-schema.json index 25adc0cc..295ed88d 100644 --- a/subworkflows/yaml-schema.json +++ b/subworkflows/yaml-schema.json @@ -64,14 +64,26 @@ "description": "Pattern of the input channel, given in Java glob syntax" }, "default": { - "type": ["string", "number", "boolean", "array", "object"], + "type": [ + "string", + "number", + "boolean", + "array", + "object" + ], "description": "Default value for the input channel" }, "enum": { "type": "array", "description": "List of allowed values for the input channel", "items": { - "type": ["string", "number", "boolean", "array", "object"] + "type": [ + "string", + "number", + "boolean", + "array", + "object" + ] }, "uniqueItems": true } @@ -106,7 +118,13 @@ "type": "array", "description": "List of allowed values for the output channel", "items": { - "type": ["string", "number", "boolean", "array", "object"] + "type": [ + "string", + "number", + "boolean", + "array", + "object" + ] }, "uniqueItems": true } @@ -117,5 +135,12 @@ } } }, - "required": ["name", "description", "keywords", "authors", "output", "components"] + "required": [ + "name", + "description", + "keywords", + "authors", + "output", + "components" + ] }