diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3b15589 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: check-json + - id: check-yaml + - id: pretty-format-json + args: + - --autofix + - --no-ensure-ascii + - --no-sort-keys + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.22.0 + hooks: + - id: check-metaschema + name: "Validating schema definition against draft schemas" + files: ^schemas/.*json$ + types: [json] diff --git a/.travis.yml b/.travis.yml index fc3e2a4..06757d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,8 @@ language: python python: - - "3.6" + - "3.8" install: - - pip install git+https://github.com/Julian/jsonschema.git@v3.0.2#egg=jsonschema + - pip install git+https://github.com/python-jsonschema/check-jsonschema.git@0.20.0#egg=check-jsonschema - wget -O draft7.json http://json-schema.org/draft-07/schema - - wget -O draft4.json http://json-schema.org/draft-04/schema script: - - jsonschema -i opentargets_chemical_probe.json draft7.json - - jsonschema -i opentargets_target_safety.json draft7.json - - jsonschema -i opentargets_tep.json draft7.json - - jsonschema -i opentargets.json draft7.json - - jsonschema -i OT_network_schema.json draft4.json + - for f in $(ls schemas/*json); do check-jsonschema --schemafile draft7.json $f ;done diff --git a/OT_network_schema.json b/OT_network_schema.json deleted file mode 100644 index 10dc828..0000000 --- a/OT_network_schema.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "schema": "http://json-schema.org/draft-04/schema#", - "title": "Open Targets Network", - "description": "Open Targets Network objects", - "type": "object", - "properties": { - "interactorA": { - "description": "Object describing the first interactor", - "type": "object", - "$ref": "#/definitions/interactor" - }, - "interactorB": { - "description": "Object describing the second interactor", - "type": "object", - "$ref": "#/definitions/interactor" - }, - "interaction": { - "description": "Object storing edge information", - "type": "object", - "properties": { - "interaction_score": { - "type": "number", - "description": "Source specific score/weight of the interaction, combined for all evidences" - }, - "causal_interaction": { - "type": "boolean", - "description": "Flag indicating wether the A->B interaction is directed or not" - }, - "evidence": { - "type": "array", - "uniqueItems": false, - "description": "JSON objects describing the evidences supporting the given interaction.", - "items": { - "type": "object", - "$ref": "#/definitions/evidence" - } - } - }, - "required": [ - "interaction_score", - "causal_interaction", - "evidence" - ] - }, - "source_info": { - "description": "Object describing source and data version", - "type": "object", - "properties": { - "source_database": { - "type": "string", - "description": "Name of the datasource." - }, - "database_version": { - "type": "string", - "description": "version of the data" - } - }, - "required": [ - "source_database", - "database_version" - ] - } - }, - "required": [ - "interactorA", - "interactorB", - "interaction", - "source_info" - ], - "definitions": { - "interactor": { - "type": "object", - "description": "Interactor description", - "properties": { - "id": { - "type": "string", - "description": "Identifier of the interactor in the given database" - }, - "id_source": { - "type": "string", - "description": "source database from where the ID is looked up", - "enum": [ - "uniprot", - "ensembl_protein", - "ensembl_gene", - "rna_base" - ] - }, - "biological_role": { - "type": [ "string", "null" ], - "description": "Describing the biological role of the interactor in the given interaction" - }, - "organism": { - "type": "object", - "description": "Organism information of the interactor", - "properties": { - "scientific_name": { - "type": "string", - "description": "Scientific name of the organism" - }, - "taxon_id": { - "type": "number", - "description": "NCBI taxon identifier of the organism" - }, - "mnemonic": { - "type": "string", - "description": "Common name of the organism." - } - }, - "required": [ - "scientific_name", - "taxon_id" - ] - } - }, - "required": [ - "id", - "id_source", - "organism", - "biological_role" - ] - }, - "evidence": { - "type": "object", - "properties": { - "interaction_identifier": { - "type": "string" - }, - "interaction_detection_method_short_name": { - "type": "string" - }, - "interaction_detection_method_mi_identifier": { - "type": "string" - }, - "pubmed_id": { - "type": "string" - }, - "evidence_score": { - "type": "number" - }, - "interaction_type_short_name": { - "type": "string" - }, - "interaction_type_mi_identifier": { - "type": "string" - }, - "host_organism_scientific_name": { - "type": "string" - }, - "host_organism_tax_id": { - "type": "number" - }, - "participant_detection_method_short_name": { - "type": "string" - }, - "participant_detection_method_mi_identifier": { - "type": "string" - }, - "expansion_method_short_name": { - "type": "string" - }, - "expansion_method_mi_identifier": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..473e3c0 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/opentargets/json_schema/master.svg)](https://results.pre-commit.ci/latest/github/opentargets/json_schema/master) + +# Schemas of the OpenTargets Platform data models + +This repository contains schema definitions of some of the data models the OpenTargets Platform deals with. +Either as an input or generates as an output. + +**Folders**: + +- `/schemas/` - List of schemas in JSON format. +- `/pydantic_models/` - Definitions of the data models using Python's [Pydantic](https://docs.pydantic.dev/) tool. [jsontopydantic](https://jsontopydantic.com/) is helpful for the purpose of defining a JSON schema as a Pydantic model. While it may require some customization, it streamlines the majority of the Pydantic boilerplate. + +## Available schemas + +- `TEP.json`: Description of [Target Enabling Packages](https://platform-docs.opentargets.org/target/chemical-probes-and-teps#target-enabling-packages). +- `chemical_probes.json`: Description of the [chemical probes](https://platform-docs.opentargets.org/target/chemical-probes-and-teps#chemical-probes) data model. +- `disease_target_evidence.json`: Description of disease-target evidence input. Separate schemas are defined for each data sources. +- `target_safety.json`: Description of [target safety](https://platform-docs.opentargets.org/target/safety). +- `molecular_interactions.json`: Definition of the [molecular interactions](https://platform-docs.opentargets.org/target/molecular-interactions) input. +- `molecular_interactions-output.json`: Definition for the molecular interactions dataset generated by the Platform ETL. + +## diff --git a/opentargets_chemical_probe.json b/opentargets_chemical_probe.json deleted file mode 100644 index c34bfec..0000000 --- a/opentargets_chemical_probe.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "title": "OpenTargets-chemical-probes", - "description": "OpenTargets Chemical Probes model.", - "type": "object", - "properties": { - "targetFromSourceId": { - "description": "Gene symbol in resource of origin.", - "examples": ["ESR1"], - "type": "string" - }, - "id": { - "description": "Probe ID as reported in Probes&Drugs.", - "examples": ["IOX1"], - "type": "string" - }, - "control": { - "description": "Inactive analogue of the probe.", - "examples": ["PF-04875474"], - "type": "string" - }, - "drugId": { - "description": "Drug molecule ID.", - "examples": ["CHEMBL1651534"], - "type": "string" - }, - "urls": { - "type": "array", - "items": { - "$ref": "#/definitions/url" - } - }, - "probesDrugsScore": { - "description": "P&D probe-likeness score.", - "exclusiveMinimum": 0, - "maximum": 100, - "type": "integer" - }, - "probeMinerScore": { - "description": "Probe Miner probe-likeness score.", - "exclusiveMinimum": 0, - "maximum": 100, - "type": "integer" - }, - "scoreInCells": { - "description": "ChemicalProbes.org score for probe-likeness to be used in model cells.", - "exclusiveMinimum": 0, - "maximum": 100, - "type": "integer" - }, - "scoreInOrganisms": { - "description": "ChemicalProbes.org score for probe-likeness to be used in model organisms.", - "exclusiveMinimum": 0, - "maximum": 100, - "type": "integer" - }, - "mechanismOfAction": { - "description": "Mechanism of action of the probe.", - "examples": [ - "blocker" - ], - "type": "array", - "items": { - "type": "string" - } - }, - "isHighQuality": { - "description": "True if selected as high quality by P&D.", - "type": "boolean" - }, - "origin": { - "description": "Origin of the probe.", - "type": "array", - "items": { - "type": "string", - "enum": [ - "experimental", - "calculated" - ], - "minItems": 1, - "uniqueItems": true - } - } - }, - "required": [ - "targetFromSourceId", - "id", - "urls", - "isHighQuality", - "origin" - ], - "additionalProperties": false, - "definitions": { - "url": { - "type": "object", - "properties": { - "niceName": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "required": [ - "niceName" - ], - "additionalProperties": false - } - } - } diff --git a/pydantic_models/chemical_probes.py b/pydantic_models/chemical_probes.py index d63e8fa..66afe31 100644 --- a/pydantic_models/chemical_probes.py +++ b/pydantic_models/chemical_probes.py @@ -49,6 +49,6 @@ def validator(item): return False return True - + print(validator(ex)) -print(ChemicalProbes.schema_json(indent=2)) \ No newline at end of file +print(ChemicalProbes.schema_json(indent=2)) diff --git a/pydantic_models/target_safety_liabilities.py b/pydantic_models/target_safety_liabilities.py index 7486119..a354747 100644 --- a/pydantic_models/target_safety_liabilities.py +++ b/pydantic_models/target_safety_liabilities.py @@ -43,7 +43,7 @@ class Study(BaseModel): description: Optional[str] = Field(description='Description of the study.') name: Optional[str] = Field(description='Name of the study.', examples='ACEA_ER_80hr') - type: Optional[str] = Field(description='Conceptual biological and/or chemical features of the study.', examples='cell-based') + type: Optional[str] = Field(description='Conceptual biological and/or chemical features of the study.', examples='cell-based') class Config: extra = Extra.forbid anystr_strip_whitespace = True @@ -86,6 +86,6 @@ def validator(item): return False return True - + print(validator(ex)) -print(TargetSafety.schema_json(indent=2)) \ No newline at end of file +print(TargetSafety.schema_json(indent=2)) diff --git a/opentargets_tep.json b/schemas/TEP.json similarity index 85% rename from opentargets_tep.json rename to schemas/TEP.json index 43efc44..a12fab4 100644 --- a/opentargets_tep.json +++ b/schemas/TEP.json @@ -4,7 +4,7 @@ "description": "OpenTargets TEP (Target Enabling Package) objects", "type": "object", "properties": { - "targetFromSourceId" : { + "targetFromSourceId": { "type": "string", "description": "Target ID in resource of origin (accepted sources include Ensembl gene ID, Uniprot ID, gene symbol)", "examples": [ @@ -13,7 +13,10 @@ ] }, "url": { - "type": ["string", "null"], + "type": [ + "string", + "null" + ], "description": "Link pointing to the TEP page.", "examples": [ "https://www.thesgc.org/tep/moesin" @@ -21,7 +24,10 @@ "pattern": "^https://|http://" }, "therapeuticArea": { - "type": ["string", "null"], + "type": [ + "string", + "null" + ], "description": "Broad description of the therapeutic area relevant to the target. Might be more terms separated by comma.", "examples": [ "Metabolic diseases", @@ -29,7 +35,10 @@ ] }, "description": { - "type": ["string", "null"], + "type": [ + "string", + "null" + ], "description": "Description of the target.", "examples": [ "Fibrinogen-like globe domain of human Tenascin-C (hFBG-C)" diff --git a/schemas/chemical_probes.json b/schemas/chemical_probes.json new file mode 100644 index 0000000..d5d5680 --- /dev/null +++ b/schemas/chemical_probes.json @@ -0,0 +1,117 @@ +{ + "title": "OpenTargets-chemical-probes", + "description": "OpenTargets Chemical Probes model.", + "type": "object", + "properties": { + "targetFromSourceId": { + "description": "Gene symbol in resource of origin.", + "examples": [ + "ESR1" + ], + "type": "string" + }, + "id": { + "description": "Probe ID as reported in Probes&Drugs.", + "examples": [ + "IOX1" + ], + "type": "string" + }, + "control": { + "description": "Inactive analogue of the probe.", + "examples": [ + "PF-04875474" + ], + "type": "string" + }, + "drugId": { + "description": "Drug molecule ID.", + "examples": [ + "CHEMBL1651534" + ], + "type": "string" + }, + "urls": { + "type": "array", + "items": { + "$ref": "#/definitions/url" + } + }, + "probesDrugsScore": { + "description": "P&D probe-likeness score.", + "exclusiveMinimum": 0, + "maximum": 100, + "type": "integer" + }, + "probeMinerScore": { + "description": "Probe Miner probe-likeness score.", + "exclusiveMinimum": 0, + "maximum": 100, + "type": "integer" + }, + "scoreInCells": { + "description": "ChemicalProbes.org score for probe-likeness to be used in model cells.", + "exclusiveMinimum": 0, + "maximum": 100, + "type": "integer" + }, + "scoreInOrganisms": { + "description": "ChemicalProbes.org score for probe-likeness to be used in model organisms.", + "exclusiveMinimum": 0, + "maximum": 100, + "type": "integer" + }, + "mechanismOfAction": { + "description": "Mechanism of action of the probe.", + "examples": [ + "blocker" + ], + "type": "array", + "items": { + "type": "string" + } + }, + "isHighQuality": { + "description": "True if selected as high quality by P&D.", + "type": "boolean" + }, + "origin": { + "description": "Origin of the probe.", + "type": "array", + "items": { + "type": "string", + "enum": [ + "experimental", + "calculated" + ], + "minItems": 1, + "uniqueItems": true + } + } + }, + "required": [ + "targetFromSourceId", + "id", + "urls", + "isHighQuality", + "origin" + ], + "additionalProperties": false, + "definitions": { + "url": { + "type": "object", + "properties": { + "niceName": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "niceName" + ], + "additionalProperties": false + } + } +} diff --git a/opentargets.json b/schemas/disease_target_evidence.json similarity index 97% rename from opentargets.json rename to schemas/disease_target_evidence.json index 83c01ff..4119507 100644 --- a/opentargets.json +++ b/schemas/disease_target_evidence.json @@ -56,42 +56,42 @@ "datasourceId": { "const": "cancer_biomarkers" }, - "datatypeId": { - "$ref": "#/definitions/datatypeId" - }, - "biomarkerName": { - "$ref": "#/definitions/biomarkerName" - }, - "biomarkers": { - "$ref": "#/definitions/biomarkers" - }, - "confidence": { - "$ref": "#/definitions/confidence" - }, - "diseaseFromSource": { - "$ref": "#/definitions/diseaseFromSource" - }, - "diseaseFromSourceMappedId": { - "$ref": "#/definitions/diseaseFromSourceMappedId" - }, - "drugFromSource": { - "$ref": "#/definitions/drugFromSource" - }, - "drugId": { - "$ref": "#/definitions/drugId" - }, - "drugResponse": { - "$ref": "#/definitions/drugResponse" - }, - "literature": { - "$ref": "#/definitions/literature" - }, - "targetFromSourceId": { - "$ref": "#/definitions/targetFromSourceId" - }, - "urls": { - "$ref": "#/definitions/urls" - } + "datatypeId": { + "$ref": "#/definitions/datatypeId" + }, + "biomarkerName": { + "$ref": "#/definitions/biomarkerName" + }, + "biomarkers": { + "$ref": "#/definitions/biomarkers" + }, + "confidence": { + "$ref": "#/definitions/confidence" + }, + "diseaseFromSource": { + "$ref": "#/definitions/diseaseFromSource" + }, + "diseaseFromSourceMappedId": { + "$ref": "#/definitions/diseaseFromSourceMappedId" + }, + "drugFromSource": { + "$ref": "#/definitions/drugFromSource" + }, + "drugId": { + "$ref": "#/definitions/drugId" + }, + "drugResponse": { + "$ref": "#/definitions/drugResponse" + }, + "literature": { + "$ref": "#/definitions/literature" + }, + "targetFromSourceId": { + "$ref": "#/definitions/targetFromSourceId" + }, + "urls": { + "$ref": "#/definitions/urls" + } }, "required": [ "biomarkerName", @@ -586,7 +586,7 @@ "diseaseFromSourceMappedId": { "$ref": "#/definitions/diseaseFromSourceMappedId" }, - "variantFunctionalConsequenceId": { + "variantFunctionalConsequenceId": { "$ref": "#/definitions/variantFunctionalConsequenceId" } }, @@ -838,7 +838,7 @@ "additionalProperties": false }, { - "properties":{ + "properties": { "datasourceId": { "const": "ot_crispr" }, @@ -900,7 +900,6 @@ "projectId", "projectDescription", "resourceScore", - "studyOverview", "studyId" ], "additionalProperties": false @@ -976,7 +975,7 @@ "const": "ot_genetics_portal" }, "beta": { - "$ref": "#/definitions/beta" + "$ref": "#/definitions/beta" }, "oddsRatioConfidenceIntervalLower": { "$ref": "#/definitions/confidenceIntervalLower" @@ -1395,7 +1394,9 @@ "ancestryId": { "type": "string", "description": "Identifier of the ancestry in the HANCESTRO ontology", - "examples": ["HANCESTRO_006"], + "examples": [ + "HANCESTRO_006" + ], "pattern": "HANCESTRO_\\d+" }, "alleleOrigins": { @@ -1466,7 +1467,7 @@ "biomarkerList": { "type": "array", "description": "List of biomarkers associated with the biological model.", - "items":{ + "items": { "type": "object", "description": "One biomarker for the model", "properties": { @@ -1513,7 +1514,9 @@ "$ref": "#/definitions/variantFunctionalConsequenceId" } }, - "required": ["name"], + "required": [ + "name" + ], "additionalProperties": false }, "uniqueItems": true @@ -1539,7 +1542,9 @@ ] } }, - "required": ["name"], + "required": [ + "name" + ], "additionalProperties": false }, "uniqueItems": true @@ -1689,28 +1694,28 @@ "items": { "type": "object", "properties": { - "id" : { + "id": { "type": "string", "description": "Cell type identifier in cell ontology or in cell model database", "examples": [ "SIDM01076" ] }, - "name" : { + "name": { "type": "string", "description": "Name of the cell model", "examples": [ "BC-1" ] }, - "tissue" : { + "tissue": { "type": "string", "description": "Name of the tissue from which the cells were sampled", "examples": [ "pancreas" ] }, - "tissueId" : { + "tissueId": { "type": "string", "description": "UBERON identifier of the anatomical unit the cells were sampled.", "examples": [ @@ -1784,7 +1789,9 @@ } }, "additionalProperties": false, - "required": ["id"] + "required": [ + "id" + ] }, "minItems": 1, "uniqueItems": true @@ -1914,7 +1921,9 @@ ] } }, - "required": ["name"], + "required": [ + "name" + ], "additionalProperties": false }, "minItems": 1, @@ -1943,7 +1952,7 @@ "minItems": 1, "uniqueItems": true }, - "projectId":{ + "projectId": { "type": "string", "description": "The identifer of the project that generated the data.", "examples": [ @@ -2027,8 +2036,7 @@ "women" ] } - } - , + }, "significantDriverMethods": { "type": "array", "description": "Methods to detect cancer driver genes producing significant results", @@ -2268,7 +2276,6 @@ "examples": [ "https://clinicaltrials.gov/search?id=%22NCT01917656%22", "https://search.clinicalgenome.org/kb/gene-validity/d910a9d8-516e-443d-acba-8d61f7574792--2018-06-07T14:23:53" - ] }, "niceName": { @@ -2372,7 +2379,7 @@ }, "uniqueItems": true }, - "warningMessage":{ + "warningMessage": { "type": "string", "description": "Free text description of any concerns or warnings about the data." } diff --git a/schemas/molecular_interaction_evidence.json b/schemas/molecular_interaction_evidence.json deleted file mode 100644 index e225c4e..0000000 --- a/schemas/molecular_interaction_evidence.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "OpenTargets-interactions-output", - "version": "1.0.0", - "description": "OpenTargets molecular interaction objects outputted from the ETL", - "type": "object", - "additionalProperties": false, - "properties": { - "count": { - "$ref": "#/$defs/count" - }, - "intA": { - "$ref": "#/$defs/interactor" - }, - "intABiologicalRole": { - "$ref": "#/$defs/interactorBiologicalRole" - }, - "intB": { - "$ref": "#/$defs/interactor" - }, - "intBBiologicalRole": { - "$ref": "#/$defs/interactorBiologicalRole" - }, - "scoring": { - "$ref": "#/$defs/scoring" - }, - "sourceDatabase": { - "$ref": "#/$defs/sourceDatabase" - }, - "speciesA": { - "$ref": "#/$defs/species" - }, - "speciesB": { - "$ref": "#/$defs/species" - }, - "targetA": { - "$ref": "#/$defs/target" - }, - "targetB": { - "$ref": "#/$defs/target" - } - }, - "required": [ - "intA", - "intB", - "sourceDatabase" - ], - "$defs": { - "count": { - "type": "number", - "description": "Number of evidence supporting the interaction." - }, - "interactor": { - "type": "string", - "description": "Identifier of the interactor in the given database.", - "examples": [ - "ENSP00000005226", - "P26371", - "Q9BYR3", - "O00303" - ] - }, - "interactorBiologicalRole": { - "type": "string", - "description": "Biological role of the interactor in the given interaction.", - "examples": [ - "enzyme target" - ] - }, - "scoring": { - "type": ["number", "null"], - "description": "Source specific score/weight of the interaction, combined for all evidences." - }, - "sourceDatabase": { - "type": "string", - "description": "Name of the datasource.", - "enum": [ - "intact", - "signor", - "string", - "reactome" - ] - }, - "species": { - "type": "object", - "additionalProperties": false, - "properties": { - "mnemonic": { - "type": "string", - "description": "Common name of the organism.", - "examples": [ - "human", - "Sendai virus" - ] - }, - "scientific_name": { - "type": ["string", "null"], - "description": "Scientific name of the organism.", - "examples": [ - "Homo sapiens", - "Bovine herpesvirus 4" - ] - }, - "taxon_id": { - "type": "number", - "description": "NCBI taxon identifier of the organism." - } - }, - "required": [ - "scientific_name", - "taxon_id" - ] - }, - "target": { - "type": ["string", "null"], - "description": "Target ID in resource of origin." - } - } -} \ No newline at end of file diff --git a/schemas/molecular_interactions-output.json b/schemas/molecular_interactions-output.json new file mode 100644 index 0000000..2f6f105 --- /dev/null +++ b/schemas/molecular_interactions-output.json @@ -0,0 +1,128 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OpenTargets-interactions-output", + "version": "1.0.0", + "description": "OpenTargets molecular interaction objects outputted from the ETL", + "type": "object", + "additionalProperties": false, + "properties": { + "count": { + "$ref": "#/$defs/count" + }, + "intA": { + "$ref": "#/$defs/interactor" + }, + "intABiologicalRole": { + "$ref": "#/$defs/interactorBiologicalRole" + }, + "intB": { + "$ref": "#/$defs/interactor" + }, + "intBBiologicalRole": { + "$ref": "#/$defs/interactorBiologicalRole" + }, + "scoring": { + "$ref": "#/$defs/scoring" + }, + "sourceDatabase": { + "$ref": "#/$defs/sourceDatabase" + }, + "speciesA": { + "$ref": "#/$defs/species" + }, + "speciesB": { + "$ref": "#/$defs/species" + }, + "targetA": { + "$ref": "#/$defs/target" + }, + "targetB": { + "$ref": "#/$defs/target" + } + }, + "required": [ + "intA", + "intB", + "sourceDatabase" + ], + "$defs": { + "count": { + "type": "number", + "description": "Number of evidence supporting the interaction." + }, + "interactor": { + "type": "string", + "description": "Identifier of the interactor in the given database.", + "examples": [ + "ENSP00000005226", + "P26371", + "Q9BYR3", + "O00303" + ] + }, + "interactorBiologicalRole": { + "type": "string", + "description": "Biological role of the interactor in the given interaction.", + "examples": [ + "enzyme target" + ] + }, + "scoring": { + "type": [ + "number", + "null" + ], + "description": "Source specific score/weight of the interaction, combined for all evidences." + }, + "sourceDatabase": { + "type": "string", + "description": "Name of the datasource.", + "enum": [ + "intact", + "signor", + "string", + "reactome" + ] + }, + "species": { + "type": "object", + "additionalProperties": false, + "properties": { + "mnemonic": { + "type": "string", + "description": "Common name of the organism.", + "examples": [ + "human", + "Sendai virus" + ] + }, + "scientific_name": { + "type": [ + "string", + "null" + ], + "description": "Scientific name of the organism.", + "examples": [ + "Homo sapiens", + "Bovine herpesvirus 4" + ] + }, + "taxon_id": { + "type": "number", + "description": "NCBI taxon identifier of the organism." + } + }, + "required": [ + "scientific_name", + "taxon_id" + ] + }, + "target": { + "type": [ + "string", + "null" + ], + "description": "Target ID in resource of origin." + } + } +} diff --git a/schemas/molecular_interactions.json b/schemas/molecular_interactions.json new file mode 100644 index 0000000..0e5b255 --- /dev/null +++ b/schemas/molecular_interactions.json @@ -0,0 +1,171 @@ +{ + "schema": "http://json-schema.org/draft-04/schema#", + "title": "Open Targets Network", + "description": "Open Targets Network objects", + "type": "object", + "properties": { + "interactorA": { + "description": "Object describing the first interactor", + "type": "object", + "$ref": "#/definitions/interactor" + }, + "interactorB": { + "description": "Object describing the second interactor", + "type": "object", + "$ref": "#/definitions/interactor" + }, + "interaction": { + "description": "Object storing edge information", + "type": "object", + "properties": { + "interaction_score": { + "type": "number", + "description": "Source specific score/weight of the interaction, combined for all evidences" + }, + "causal_interaction": { + "type": "boolean", + "description": "Flag indicating wether the A->B interaction is directed or not" + }, + "evidence": { + "type": "array", + "uniqueItems": false, + "description": "JSON objects describing the evidences supporting the given interaction.", + "items": { + "type": "object", + "$ref": "#/definitions/evidence" + } + } + }, + "required": [ + "interaction_score", + "causal_interaction", + "evidence" + ] + }, + "source_info": { + "description": "Object describing source and data version", + "type": "object", + "properties": { + "source_database": { + "type": "string", + "description": "Name of the datasource." + }, + "database_version": { + "type": "string", + "description": "version of the data" + } + }, + "required": [ + "source_database", + "database_version" + ] + } + }, + "required": [ + "interactorA", + "interactorB", + "interaction", + "source_info" + ], + "definitions": { + "interactor": { + "type": "object", + "description": "Interactor description", + "properties": { + "id": { + "type": "string", + "description": "Identifier of the interactor in the given database" + }, + "id_source": { + "type": "string", + "description": "source database from where the ID is looked up", + "enum": [ + "uniprot", + "ensembl_protein", + "ensembl_gene", + "rna_base" + ] + }, + "biological_role": { + "type": [ + "string", + "null" + ], + "description": "Describing the biological role of the interactor in the given interaction" + }, + "organism": { + "type": "object", + "description": "Organism information of the interactor", + "properties": { + "scientific_name": { + "type": "string", + "description": "Scientific name of the organism" + }, + "taxon_id": { + "type": "number", + "description": "NCBI taxon identifier of the organism" + }, + "mnemonic": { + "type": "string", + "description": "Common name of the organism." + } + }, + "required": [ + "scientific_name", + "taxon_id" + ] + } + }, + "required": [ + "id", + "id_source", + "organism", + "biological_role" + ] + }, + "evidence": { + "type": "object", + "properties": { + "interaction_identifier": { + "type": "string" + }, + "interaction_detection_method_short_name": { + "type": "string" + }, + "interaction_detection_method_mi_identifier": { + "type": "string" + }, + "pubmed_id": { + "type": "string" + }, + "evidence_score": { + "type": "number" + }, + "interaction_type_short_name": { + "type": "string" + }, + "interaction_type_mi_identifier": { + "type": "string" + }, + "host_organism_scientific_name": { + "type": "string" + }, + "host_organism_tax_id": { + "type": "number" + }, + "participant_detection_method_short_name": { + "type": "string" + }, + "participant_detection_method_mi_identifier": { + "type": "string" + }, + "expansion_method_short_name": { + "type": "string" + }, + "expansion_method_mi_identifier": { + "type": "string" + } + } + } + } +} diff --git a/opentargets_target_safety.json b/schemas/target_safety.json similarity index 95% rename from opentargets_target_safety.json rename to schemas/target_safety.json index eea18e2..40fc008 100644 --- a/opentargets_target_safety.json +++ b/schemas/target_safety.json @@ -51,13 +51,13 @@ "description": "Source of safety event.", "type": "string", "enum": [ - "Force et al. (2011)", - "Lamore et al. (2017)", - "Lynch et al. (2017)", - "Bowes et al. (2012)", - "Urban et al. (2012)", - "ToxCast", - "AOP-Wiki" + "Force et al. (2011)", + "Lamore et al. (2017)", + "Lynch et al. (2017)", + "Bowes et al. (2012)", + "Urban et al. (2012)", + "ToxCast", + "AOP-Wiki" ] }, "literature": { @@ -205,4 +205,4 @@ } } } -} \ No newline at end of file +}