{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aptatlas.org/data/proteins.schema.json",
  "title": "Protein catalogue",
  "description": "One row per catalogue entry; a protein is one canonical Swiss-Prot accession.",
  "type": "object",
  "required": [
    "schema",
    "name",
    "title",
    "version",
    "last_updated",
    "licence",
    "licence_url",
    "citation",
    "archive_doi",
    "third_party",
    "data"
  ],
  "additionalProperties": false,
  "properties": {
    "schema": {
      "type": "string",
      "description": "URL of this schema for this release"
    },
    "name": {
      "const": "proteins"
    },
    "title": {
      "type": "string"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+$",
      "description": "APT release"
    },
    "last_updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "licence": {
      "const": "CC-BY-4.0"
    },
    "licence_url": {
      "type": "string"
    },
    "citation": {
      "type": "string"
    },
    "archive_doi": {
      "type": "string"
    },
    "third_party": {
      "type": "array",
      "description": "Sources this file draws on that carry their own licence.",
      "items": {
        "type": "object",
        "required": [
          "name",
          "licence",
          "url",
          "relationship",
          "note"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "licence": {
            "type": "string",
            "description": "SPDX identifier"
          },
          "url": {
            "type": "string"
          },
          "relationship": {
            "enum": [
              "source",
              "derived"
            ]
          },
          "note": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "JSONPath, relative to data, of fields derived from this source"
          },
          "fields_derived_in_part": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "JSONPath, relative to data, of fields computed partly from the fields above"
          }
        }
      }
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "uniprot": {
            "type": "string"
          },
          "gene": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "platforms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "platformCount": {
            "type": "integer"
          },
          "canonical": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "alamarPanels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "canonical_by_platform": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "uniprot",
          "gene",
          "name",
          "platforms",
          "platformCount",
          "canonical"
        ],
        "additionalProperties": false
      }
    }
  }
}
