Merging improvements from https://github.com/skodapetr/funpdbe-validator skodapetr@github - "fix multiple molecules issue"

This commit is contained in:
Mihaly Varadi 2019-03-22 13:04:00 +00:00
parent 89ac85e304
commit 78b3f53a5f
2 changed files with 28 additions and 19 deletions

View file

@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "https://github.com/funpdbe-consortium/funpdbe_schema/blob/master/funpdbe_schema.v0.0.1.json",
"$id": "https://gitlab.ebi.ac.uk/pdbe-kb/funpdbe/funpdbe-schema/raw/master/funpdbe_schema.json",
"title": "funpdbe_schema",
"type": "object",
"properties": {
@ -32,7 +32,8 @@
},
"additional_entry_annotations": {
"type": "object",
"description": "Additional entry-level annotations"
"description": "Additional entry-level annotations",
"additionalProperties": true
},
"chains": {
"type": "array",
@ -45,7 +46,8 @@
},
"additional_chain_annotations": {
"type": "object",
"description": "Additional chain-level annotations"
"description": "Additional chain-level annotations",
"additionalProperties": true
},
"residues": {
"type": "array",
@ -63,7 +65,8 @@
},
"additional_residue_annotations": {
"type": "object",
"description": "Additional residue-level annotations"
"description": "Additional residue-level annotations",
"additionalProperties": true
},
"site_data": {
"type": "array",
@ -80,9 +83,8 @@
},
"confidence_score": {
"type": "number",
"description": "Confidence level of the annotation (0-1)",
"minimum": 0.0,
"maximum": 1.0
"description": "Confidence level of the annotation (0-1, except if the method justifies otherwise)",
"minimum": 0.0
},
"confidence_classification": {
"type": "string",
@ -91,14 +93,18 @@
"high",
"medium",
"low",
"null"
"null",
"curated"
]
},
"aa_variant": {
"type": "string",
"description": "Three-letter amino acid code of variant/mutant",
"pattern": "^[A-Za-z0-9]+$"
}
},
"required": [
"site_id_ref",
"raw_score",
"confidence_score",
"confidence_classification"
],
"additionalProperties": false
@ -155,7 +161,8 @@
},
"additional_site_annotations": {
"type": "object",
"description": "Additional site-level annotations"
"description": "Additional site-level annotations",
"additionalProperties": true
}
},
"required": [

View file

@ -2,11 +2,9 @@
"""
Copyright 2018 EMBL - European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
@ -27,7 +25,6 @@ class ResidueIndexes(object):
and each has to match the indices in the official PDB entry
This class relies on the PDBe API to get the current residue
indices
Example usage:
check_indexes = ResidueIndexes(your_json_object)
if check_indexes.check_every_residue():
@ -119,17 +116,22 @@ class ResidueIndexes(object):
:param depositor_aa_type: Residue amino acid code provided by user
:return: True is residue numbering is valid, False if not
"""
flag = None
flag = False
for item in data:
sub_data = item[label]
if label == "chains":
flag = self._recursive_loop(sub_data, "residues", depositor_residue_number, depositor_aa_type,
flag |= self._recursive_loop(sub_data, "residues", depositor_residue_number, depositor_aa_type,
depositor_chain_id)
elif label == "residues":
return self._process_residues(sub_data, depositor_residue_number, depositor_aa_type, depositor_chain_id)
if label == "chains":
return flag
if label == "residues":
# We were checking residues and none was found, so not match found -> False.
return False
def _process_residues(self, residues, depositor_residue_number, depositor_aa_type, depositor_chain_id):
"""
This method grabs the residue information and call the comparator if the
@ -158,7 +160,7 @@ class ResidueIndexes(object):
:param depositor_residue_number: Residue number provided by the user
:return: True is residue numbering is valid, False if not
"""
if residue_name == depositor_aa_type:
if residue_name.lower() == depositor_aa_type.lower():
return True
mismatch = "residue %s_%s (%s) in data does not match residue %s (%s) in PDB" % (
depositor_chain_id, depositor_residue_number, depositor_aa_type, depositor_residue_number, residue_name)