From 7e45e486b2101a54da2ed380f6ea19eeaf89c73c Mon Sep 17 00:00:00 2001 From: LTLA Date: Wed, 21 Feb 2024 08:43:33 -0800 Subject: [PATCH] Added GitHub as a source, added version property for storing hashes. - Also renamed 'other' to 'URL' to be more explicit. - Expanded the source property descriptions to be more informative. --- schemas/bioconductor/v1.json | 49 ++++++++++++++++++++++++++++++++--- tests/bioconductor/v1.test.js | 7 +++-- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/schemas/bioconductor/v1.json b/schemas/bioconductor/v1.json index eeaace8..ed90979 100644 --- a/schemas/bioconductor/v1.json +++ b/schemas/bioconductor/v1.json @@ -65,43 +65,84 @@ "properties": { "provider": { "type": "string", - "description": "Name of the data provider.", - "enum": [ "GEO", "SRA", "ArrayExpress", "PubMed", "ExperimentHub", "DOI", "other" ] + "enum": [ + "GEO", + "SRA", + "ArrayExpress", + "PubMed", + "ExperimentHub", + "GitHub", + "DOI", + "URL" + ], + "_description": [ + "Name of the data provider.", + "- `GEO`: Gene Expression Omnibus (NCBI). The `id` should be a GSE or GSM identifier.", + "- `SRA`: Sequence Read Archive (NCBI). The `id` should be a SRR or SRP identifier.", + "- `ArrayExpress`: ArrayExpress (EMBL-EBI). The `id` should be an E-MTAB identifier.", + "- `PubMed`: PubMed (NIH). The `id` should be a PMID.", + "- `ExperimentHub`: ExperimentHub (Bioconductor). The `id` should be an EH identifier.", + "- `GitHub`: GitHub repository. The `id` should be the full name of the repository, including the owner.", + "- `DOI`: a DOI to a remote resource. The `id` should be the DOI string (not a URL containing the DOI).", + "- `URL`: a URL to a remote resource. The `id` should be a full URL string, including the initial `http`." + ] }, "id": { "type": "string", - "description": "Provider-specific identifier for the data source." + "_description": [ + "Provider-specific identifier for the data source." + ] + }, + "version": { + "type": "string", + "_description": [ + "Provider-specific version, if the `id` is potentially mutable.", + "- For GitHub, we recommend using a release tag or the commit hash.", + "- For URLs, we recommend setting this to the date of accessing the URL." + ] } }, "required": [ "provider", "id" ], "additionalProperties": false, + "allOf": [ { "if": { "properties": { "provider": { "const": "GEO" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^GS[EM][0-9]+$" } } } }, + { "if": { "properties": { "provider": { "const": "SRA" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^SR[PR][0-9]+$" } } } }, + { "if": { "properties": { "provider": { "const": "ArrayExpress" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^E-MTAB-[0-9]+$" } } } }, + { "if": { "properties": { "provider": { "const": "PubMed" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^[1-9][0-9]+$" } } } }, + { "if": { "properties": { "provider": { "const": "ExperimentHub" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^EH[0-9]+$" } } } }, + + { + "if": { "properties": { "provider": { "const": "GitHub" } } }, + "then": { "properties": { "id": { "type": "string", "pattern": "[^/]/[^/]" } } } + }, + { "if": { "properties": { "provider": { "const": "DOI" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^[a-zA-Z0-9\\.]+/[a-zA-Z0-9\\.]+$" } } } }, + { - "if": { "properties": { "provider": { "const": "other" } } }, + "if": { "properties": { "provider": { "const": "URL" } } }, "then": { "properties": { "id": { "type": "string", "pattern": "^https?://[^\\s]+$" } } } } ] diff --git a/tests/bioconductor/v1.test.js b/tests/bioconductor/v1.test.js index 4aae773..3d06184 100644 --- a/tests/bioconductor/v1.test.js +++ b/tests/bioconductor/v1.test.js @@ -28,7 +28,8 @@ test("Bioconductor schema behaves as expected", () => { { provider: "PubMed", id: "12332423" }, { provider: "DOI", id: "123.13/231.23" }, { provider: "ExperimentHub", id: "EH12345" }, - { provider: "other", id: "https://123213.com" } + { provider: "GitHub", id: "ArtifactDB/foobar", version: "v1" }, + { provider: "URL", id: "https://123213.com", version: "2029-10-10" } ], maintainer_name: "Aaron Lun", maintainer_email: "aaron@aaron.com", @@ -113,9 +114,11 @@ test("Bioconductor schema behaves as expected", () => { expect(() => validate(obj)).toThrow("pattern"); obj.sources = [{ provider: "ExperimentHub", id: "foo" }]; expect(() => validate(obj)).toThrow("pattern"); + obj.sources = [{ provider: "GitHub", id: "foo" }]; + expect(() => validate(obj)).toThrow("pattern"); obj.sources = [{ provider: "DOI", id: "foo" }]; expect(() => validate(obj)).toThrow("pattern"); - obj.sources = [{ provider: "other", id: "foo" }]; + obj.sources = [{ provider: "URL", id: "foo" }]; expect(() => validate(obj)).toThrow("pattern"); obj.sources = [{ provider: "random", id: "123123" }]; expect(() => validate(obj)).toThrow("one of");