{
    "$schema": "http://json-schema.org/2020-12/schema#",
    "$ref": "#/definitions/Data",
    "definitions": {
        "Data": {
            "description": "All meta data provided for the AlphaFill run ",
            "type": "object",
            "properties": {
                "alphafill_version": {
                    "description": "Version of AlphaFill that was used",
                    "type": "string"
                },
                "date": {
                    "description": "Date of AlphaFill run",
                    "type": "string"
                },
                "source": {
                    "description": "Data source for input model",
                    "type": "string",
                    "enum": ["AFDB", "BFVD", "user"]
                },
                "file": {
                    "description": "Input file used for AlphaFill",
                    "type": "string"
                },
                "hits": {
                    "description": "List of hits",
                    "oneOf": [
            				{"type": "null"},
            				{"$ref":"#/definitions/Hit"}]
                },
                "id": {
                    "description": "AlphaFold identifier",
                    "type": "string"}
            },
            "required": [
                "alphafill_version",
                "date",
                "file",
                "hits",
                "id"
            ],
            "title": "Data"
        },
        "Hit": {
            "type": "array",
            "properties": {
                "alignment": {
                    "description": "Details about the alignment of the inputmodel with the PDB-REDO model",
                    "$ref": "#/definitions/Alignment"
                },
                "global_rmsd": {
                    "description": "Root-Mean-Square Deviation of the hit compared to the AlphaFold model",
                    "type": "number"
                },
                "pdb_asym_id": {
                    "description": "Asym_id as found in mmCIF file corresponing to the PDB-REDO entry",
                    "type": "string"
                },
                "pdb_id": {
                    "description": "PDB identifier",
                    "type": "string"
                },
                "transplants": {
                    "description": "List of ligands that was transplanted from the PDB-REDO model",
                    "$ref": "#/definitions/Transplant"}
            },
            "required": [
                "alignment",
                "global_rmsd",                
                "pdb_asym_id",
                "pdb_id",
                "transplants"
            ],
            "title": "Hit"
        },
        "Alignment": {
            "type": "object",
            "properties": {
                "af_start": {
                    "description" : "Position of the residue in the AlphaFold or input model at which the alignment starts",
                    "type": "integer"
                },
                "identity": {
                    "description": "Identity within the alignment expressed as fractional value",
                    "type": "number"
                },
                "length": {
                    "description": "Number of residues that was used in the alignment",
                    "type": "integer"
 
                },
                "pdb_start": {
                    "description": "Position of the residue in the PDB-REDO model at which the alignment starts",
                    "type": "integer"
                }
            },
            "required": [
                "af_start",
                "identity",
                "length",
                "pdb_start"
            ],
            "title": "Alignment"
        },
        
        "Transplant": {
            "type": "object",
            "properties": {
                "analogue_id": {
                    "description": "Compound that was placed (transplanted) in the AlphaFold models by AlphaFill",
                    "type": "string"
                },
                "asym_id": {
                    "description": "Chain in which the compound was placed",
                    "type": "string"
                },
                "clash": {
                    "description": "All requirements and metadata used for calculation of the Transplant clash score (TCS)",
                    "$ref": "#/definitions/Clash"}
                },
                "compound_id": {
                    "description": "Name of the compound that was found in the corresponding PDB-REDO model",
                    "type": "string"
                },
                "local_rmsd": {
                    "description": "Root-Mean-Square Deviation of the ligand binding pocket (local RMSD)",
                    "type": ["number", "null"]
                },
                "pae" : {
                    "description": "Information about the Predicted Aligned Error (PAE) matrix of the binding site of the transplant",
                    "$ref": "#/definitions/Pae"
                    },
                "pdb_asym_id": {
                    "description": "asymID as reported in the pdb-file of the compound that was found in the corresponding PDB-REDO model",
                    "type": ["string", "null"]
                },
                "pdb_auth_asym_id": {
                    "description": "asymID as reported in the mmCIF-file of the compound that was found in the corresponding PDB-REDO model",
                    "type": ["string", "null"]
                },
                "pdb_auth_ins_code": {
                    "description": "insCode as reported in the mmCIF-file of the compound that was found in the corresponding PDB-REDO model",
                    "type": ["string", "null"]
                },
                "pdb_auth_seq_id": {
                    "description": "seqID as reported in the mmCIF-file of the compound that was found in the corresponding PDB-REDO model",
                    "type": ["string", "null"]
                },
                "validation" : {
                    "description" : "Validation score (LEV score) details, only applicable for transplants that originate from 100% sequence identity",
                    "$ref": "#/definitions/Validation"
                },
            "required": [
                "analogue_id",
                "asym_id",
                "clash",
                "compound_id",
                "pae",
                "pdb_asym_id",
                "pdb_auth_asym_id",
                "pdb_auth_ins_code",
                "pdb_auth_seq_id",
                "local_rmsd"
            ],
            "title": "Transplant"
        },
	"Clash": {
            "type": "object",
            "properties": {
                "clash_count": {
                    "description": "Number of Van-der-Waals violations",
		    "type": "integer"
                },
                "distances": {
                    "type": "array",
                    "$ref": "#/definitions/Distance"
                },
                "tranplant_atom_count": {
                    "description": "Number of atoms present in the tranplant",
		    "type": "integer"
                },
                "poly_atom_count": {
                    "description": "Number of protein atoms present within 4 Angstrom from the transplant atoms",
                    "type": "integer"
                },
                "score": {
                    "description": "Transplant clash score (TCS) calculated by the square-root of (the sum of the squared Van-der-Waals overlaps, devided by the number of distances considered).",
                    "type": "number"
            }},
            "required": [
                "clash_count",
                "distances",
                "ligand_atom_count",
                "poly_atom_count",
                "score"
            ],
            "title": "Clash"
        },
	"Distance": {
            "type": "object",
            "properties": {
                "VdW_overlap": {
                    "description": "Van-der-Waals violation",
                    "type": "number"
                },
                "distance": {
                    "description": "Distance between the transplant atom and the protein atom",
                    "type": "number"
                },
                "poly_atom": {
                    "description": "The protein atom considered in distance calculation",
                    "properties":{
                        "id": {"description":"Name of the atom", "type":"string"},
                        "seq_id":{"description":"SeqID of the atom", "type":"number"}
                        }
                },
                "res_atom_id": {
                    "description": "The transplant atom considered in distance calcualation",
                    "type" : "string"
            }},
            "required": [
                "VdW_overlap",
                "distance",
                "poly_atom",
                "res_atom_id"
            ],
            "title": "Distance"
        },
    "Pae": {
        "type": "object",
        "properties": {
            "matrix": {
                "description" : "Predicted Aligned Error (PAE) matrix of the residues involved in the transplant binding site",
                "type": "array",
                "items": {
                    "type": "array",
                    "items": {
                        "type": "integer"}
                    }
                },
            "mean" : {
                "description" : "Mean of the PAE values in the matrix of the tranplant binding site",
                "type" : "number"
                },
            "std" : {
                "description" : "Standard deviation of the PAE values in the matrix of the tranplant binding site",
                "type" : "number"
                },
            "median" : {
                "description": "Median of the values in the PAE matrix of the tranplant binding site",
                "type" : "number"
            }},
            "required": [
                "matrix"
            ],
            "title": "Pae"
    },
    "Validation": {
    "type": ["object", "null"],
    "properties": {    
        "bindingsite_atom_count": {
            "description" : "Number of atoms in the binding pocket of the tranplant that were used to calculate bindingsite_rmsd and local_environment_rmsd",
            "type": "integer"
        },
        "bindingsite_rmsd": {
            "description" : "Root-Mean-Square Deviation of the protein atoms in the tranplant binding site",
            "type": "number"
        },
        "local_environment_rmsd": {
            "description" : "Root-Mean-Square Deviation of the transplant atoms and protein atoms in its binding site (LEV score)",
            "type": "number"
        },          
        "transplant_atom_count": {
            "description" : "Number of atoms in the transplant that were used for transplant_rmsd and local_environment_rmsd calculation",
            "type": "integer"
        },
        "transplant_rmsd": {
            "description" : "Root-Mean-Square Deviation of the transplant atoms",
            "type": "number"
        }
    },
    "title": "Validation"
    }
}}
