{
  "$id": "https://github.com/GW-HIVE/glygen-backend/blob/master/api/specs/protein/search/request.schema.json",
  "type": "object",
  "properties": {
    "query": {
      "$id": "/properties/query",
      "type": "object",
      "description": "Object that contains a set of search criteria to search proteins for.",
      "minProperties": 1,
      "maxProperties": 17,
      "properties": {
        "operation": {
          "$id": "/properties/query/properties/operation",
          "type": "string",
          "description": "Logical operation used to combine the search result of the individual query parts. Possible values are AND, OR, NAND and NOR.",
          "default": "AND",
          "examples": [
              "AND",
              "OR",
              "NAND",
              "NOR"
          ]
        },
        "query_type": {
          "$id": "/properties/query/properties/query_type",
          "type": "string",
          "description": "Identifies the type of search to be performed. Currently only search_protein is supported.",
          "default": "search_protein",
          "examples": [
            "search_protein"
          ]
        },
        "uniprot_canonical_ac": {
          "$id": "/properties/query/properties/uniprot_canonical_ac",
          "type": "string",
          "description": "This value is used to search by protein ID. This can either be a complete UniProtID or a part of a UniprotID.",
          "examples": [
            "P01234"
          ]
        },
        "version": {
          "$id": "/properties/query/properties/version",
          "type": "string",
          "description": "The version of the query.",
          "examples": [
            "1.2"
          ]
        },
        "refseq_ac": {
          "$id": "/properties/query/properties/refseq_ac",
          "type": "string",
          "description": "This value is used to search by refseq accession number. This can either be a complete ID or a part of a ID.",
          "examples": [
            "P01234"
          ]
        },
        "mass": {
          "$id": "/properties/query/properties/mass",
          "type": "object",
          "description": "This object is used to search proteins by their mass. The object consists of a minimum and a maximum value specifying a mass range to search for.",
          "properties": {
            "min": {
              "$id": "/properties/query/properties/mass/properties/min",
              "type": "integer",
              "description": "Minimum value for the mass range to search for proteins. The value is specified in Dalton.",
              "default": 0,
              "examples": [
                10
              ]
            },
            "max": {
              "$id": "/properties/query/properties/mass/properties/max",
              "type": "integer",
              "description": "Maximum value for the mass range to search for proteins. The value is specified in Dalton.",
              "default": 0,
              "examples": [
                10000
              ]
            }
          },
          "required": [
            "min",
            "max"
          ]
        },
        "organism": {
          "$id": "/properties/query/properties/organism",
          "type": "object",
          "description": "This field is set if a search by organism (e.g. human) is performed. The value can either be a scientific species name (NCBI Taxonomy), a synonym or a NCBI Taxonomy ID.",
          "default": "Homo sapiens (9606)",
          "examples": [
            "Homo sapiens (9606)"
          ]
        },
        "protein_name": {
          "$id": "/properties/query/properties/protein_name",
          "type": "string",
          "description": "This value is set for a search by protein name. The value can either be a complete protein name or a partial name.",
          "default": "",
          "examples": [
            "Envelope glycoprotein"
          ]
        },
        "gene_name": {
          "$id": "/properties/query/properties/gene_name",
          "type": "string",
          "description": "This value is specifies to search proteins by their gene name. The name can either be a complete name or a partial name.",
          "default": "",
          "examples": [
            "MGAT1"
          ]
        },
        "go_term": {
          "$id": "/properties/query/properties/go_term",
          "type": "string",
          "description": "This value is used to search by go term. The value can either be a complete go term or a partial go term.",
          "default": "",
          "examples": [
            "mitochondrion"
          ]
        },
        "go_id": {
          "$id": "/properties/query/properties/go_id",
          "type": "string",
          "description": "This value is used to search by go id. The value can either be a complete go id or a partial go id.",
          "default": "",
          "examples": [
            "GO:0005739"
          ]
        },
        "pmid": {
          "$id": "/properties/query/properties/pmid",
          "type": "string",
          "description": "This value is used to search by pmid. The value can either be a complete pmid or a partial pmid.",
          "default": "",
          "examples": [
            "PMID:30646583"
          ]
        },
        "glycan": {
          "$id": "/properties/query/properties/glycan",
          "type": "object",
          "description": "This object is used to search proteins by a glycan. This can either by an attached glycan or a glycan that gets bound by the protein.",
          "properties": {
            "relation": {
              "$id": "/properties/query/properties/glycan/properties/relation",
              "type": "string",
              "description": "Describes the relationship of the glycan with the protein. Possible values are attached (for glycans that glycosylate the protein), binding (for glycans that bind to a protein) or any (includes both).",
              "default": "attached",
              "examples": [
                "attached"
              ]
            },
            "operation": {
              "$id": "/properties/query/properties/glycan/properties/operation",
              "type": "string",
              "description": "Specifies type of operation to perform.",
              "default": "OR",
              "examples": [
                "OR",
                "AND"
              ]
            },
            "glytoucan_ac": {
              "$id": "/properties/query/properties/glycan/properties/glytoucan_ac",
              "type": "string",
              "description": "GlyTouCan ID of the glycan. Single or multiple comma-separated GlyTouCan Accession(s)",
              "default": "",
              "examples": [
                "G09012,G17689DH"
              ]
            }
          }
        },
        "glycosylated_aa": {
          "$id": "/properties/query/properties/glycosylated_aa",
          "type": "object",
          "description": "Search a protein by its glycosylated amino acids.",
          "properties": {
            "operation": {
              "$id": "/properties/query/properties/glycosylated_aa/properties/operation",
              "type": "string",
              "description": "Specifies type of operation to perform.",
              "default": "AND",
              "examples": [
                "AND",
                "OR"
              ]
            },
            "aa_list": {
              "$id": "/properties/query/properties/glycosylated_aa/properties/aa_list",
              "type": "array",
              "description": "The value is a list of amino acid types in one letter code.",
              "items": {
                "$id": "/properties/query/properties/glycosylated_aa/properties/aa_list/items",
                "type": "string",
                "default": "",
                "examples": [
                  "N",
                  "S"
                ]
              }
            }
          }
        },
        "sequence": {
          "$id": "/properties/query/properties/sequence",
          "type": "object",
          "properties": {
            "aa_sequence": {
              "$id": "/properties/query/properties/sequence/properties/aa_sequence",
              "type": "string",
              "description": "Amino acid sequence to search for. The sequence is specified in one latter code. Depending on the type it has to be a complete sequence or a part of a sequence.",
              "default": "",
              "examples": [
                "NSTRFV"
              ]
            },
            "type": {
              "$id": "/properties/query/properties/sequence/properties/type",
              "type": "string",
              "description": "Type of sequence search. Possible values are exact (find proteins with exactly this sequence),or blast (proteins that are similar).",
              "default": "exact",
              "examples": [
                "exact"
              ]
            }
          },
          "required": [
            "aa_sequence",
            "type"
          ]
        },
        "pathway_id": {
          "$id": "/properties/query/properties/pathway_id",
          "type": "string",
          "description": "Search for proteins involved in a certain pathway. The pathway is specified by its name.",
          "examples": [
            "melatonin biosynthesis"
          ]
        },
        "glycosylation_evidence": {
          "$id": "/properties/query/properties/glycosylation_evidence",
          "type": "string",
          "description": "Search for proteins based on the evidence for the glycosylation sites. Possible values are calculated, experimental, none or any.",
          "default": "any",
          "examples": [
            "calculated"
          ]
        }
      },
      "required": [
        "operation",
        "query_type",
        "version"
      ]
    }
  },
  "required": [
    "query"
  ]
}