Skip to content

Commit

Permalink
Added GitHub as a source, added version property for storing hashes.
Browse files Browse the repository at this point in the history
- Also renamed 'other' to 'URL' to be more explicit.
- Expanded the source property descriptions to be more informative.
  • Loading branch information
LTLA committed Feb 21, 2024
1 parent 8440cd0 commit 7e45e48
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
49 changes: 45 additions & 4 deletions schemas/bioconductor/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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]+$" } } }
}
]
Expand Down
7 changes: 5 additions & 2 deletions tests/bioconductor/v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]",
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 7e45e48

Please sign in to comment.