funpdbe-validator


Namefunpdbe-validator JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/PDBe-KB/funpdbe-validator
SummaryValidate PDBe-KB JSONs by FunPDBe Schema
upload_time2023-11-06 16:25:30
maintainer
docs_urlNone
authorMihaly Varadi
requires_python>=3.6
license
keywords json funpdbe_validator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            FunPDBe JSON Validator
======================

[![Build Status](https://travis-ci.com/PDBe-KB/funpdbe-validator.svg?branch=master)](https://travis-ci.com/PDBe-KB/funpdbe-validator)
[![codecov](https://codecov.io/gh/PDBe-KB/funpdbe-validator/branch/master/graph/badge.svg?token=MQMUUE5DJO)](https://codecov.io/gh/PDBe-KB/funpdbe-validator)
[![Maintainability](https://api.codeclimate.com/v1/badges/583ee28bcdc5d62a2b1e/maintainability)](https://codeclimate.com/github/PDBe-KB/funpdbe-validator/maintainability)

This Python3 client can be used for validating FunPDBe JSON files. It performs various sanity checks, and validates user JSONs against the FunPDBe schema.

For more information on FunPDBe is, visit https://funpdbe.org

Quick start
-----------

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

Please note that the client is written in Python3, and the dependencies have to be installed accordingly (i.e. using pip3)!

### Installing

#### Checking out this repository from GitHub

```
$ git clone https://github.com/PDBe-KB/funpdbe-validator.git
$ cd funpdbe-validator
$ pip3 install -r requirements.txt
```

#### Installing with PIP

```
pip install funpdbe-validator
```

### Basic usage

This package contains two classes which handle the validation of FunPDBe JSON files.

* Validator()
* ResidueIndexes()

Basic example:
```
from funpdbe_validator.validator import Validator
from funpdbe_validator.residue_index import ResidueIndexes

def run():
    """
    Basic example of running the PDBe-KB/FunPDBe validator
    :return:
    """
    validator = Validator("name of the resource") # Same as in the JSON
    validator.load_schema()
    validator.load_json("/path/to/data.json")

    if validator.basic_checks() and validator.validate_against_schema():
        print("Passed data validations")
        residue_indexes = ResidueIndexes(validator.json_data)
        if residue_indexes.check_every_residue():
            print("Passed the index validation")
            return True
    return False


if __name__ == "__main__":
    run()
```
Using mmcif instead of PDBe-API for valiation:
ResidueIndexes class has optional arguments- 'mmcif_mode' and 'cif_file'. When mmcif_mode is set True, the validator uses given mmcif (set using cif_fie) for validation instead of PDBe-API.

```
def run(resource_name, json_path, mmcif_mode=False, cif_file =None):
    """
    Basic example of running the PDBe-KB/FunPDBe validator
    :return: None
    """
    validator = Validator(resource_name) # Same as in the JSON
    validator.load_schema()
    for json_file_path in glob.glob('%s*.json' % json_path):
        validator.load_json(json_file_path)
        if validator.basic_checks() and validator.validate_against_schema():
            print("Passed data validations for %s" % json_file_path)
            residue_indexes = ResidueIndexes(validator.json_data,mmcif_mode,cif_file)
            if residue_indexes.check_every_residue():
                print("Passed the index validation for %s" % json_file_path)
                return True
            else:
                print("Failed index validation for %s: %s" % (json_file_path, residue_indexes.mismatches))
        else:
            print("Failed data validations for %s: %s" % (json_file_path, validator.error_log))
    return False
```

### Using the "basic_run.py"

This script runs the validator for all the JSON files found at a specified path. **Note**: the path has to end with a /

```
python basic_run.py dataResourceName path/to/json/files/
```

### Using the Dockerized version

```
docker build --tag funpdbe-validator-basic .
docker run funpdbe-validator-basic dataResourceName path/to/json/files/
```

### Running the tests

Running tests for the client is performed simply by using
```
$ pytest tests
```

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/funpdbe-consortium/funpdbe-validator/tags).

## Authors

* **Mihaly Varadi** - *Initial work* - [mvaradi](https://github.com/mvaradi)

Special thanks to:
* Skoda Petr https://github.com/skodapetr
* Radoslav Krivak https://github.com/rdk

## License

This project is licensed under the EMBL-EBI License - see the [LICENSE](LICENSE) file for details

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PDBe-KB/funpdbe-validator",
    "name": "funpdbe-validator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "json funpdbe_validator",
    "author": "Mihaly Varadi",
    "author_email": "mvaradi@ebi.ac.uk",
    "download_url": "https://files.pythonhosted.org/packages/c1/d4/bfa9aebd462387b32bb33939c6c0cd6107da7f3b36e53232488fb111cf38/funpdbe-validator-1.1.3.tar.gz",
    "platform": null,
    "description": "FunPDBe JSON Validator\n======================\n\n[![Build Status](https://travis-ci.com/PDBe-KB/funpdbe-validator.svg?branch=master)](https://travis-ci.com/PDBe-KB/funpdbe-validator)\n[![codecov](https://codecov.io/gh/PDBe-KB/funpdbe-validator/branch/master/graph/badge.svg?token=MQMUUE5DJO)](https://codecov.io/gh/PDBe-KB/funpdbe-validator)\n[![Maintainability](https://api.codeclimate.com/v1/badges/583ee28bcdc5d62a2b1e/maintainability)](https://codeclimate.com/github/PDBe-KB/funpdbe-validator/maintainability)\n\nThis Python3 client can be used for validating FunPDBe JSON files. It performs various sanity checks, and validates user JSONs against the FunPDBe schema.\n\nFor more information on FunPDBe is, visit https://funpdbe.org\n\nQuick start\n-----------\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Prerequisites\n\nPlease note that the client is written in Python3, and the dependencies have to be installed accordingly (i.e. using pip3)!\n\n### Installing\n\n#### Checking out this repository from GitHub\n\n```\n$ git clone https://github.com/PDBe-KB/funpdbe-validator.git\n$ cd funpdbe-validator\n$ pip3 install -r requirements.txt\n```\n\n#### Installing with PIP\n\n```\npip install funpdbe-validator\n```\n\n### Basic usage\n\nThis package contains two classes which handle the validation of FunPDBe JSON files.\n\n* Validator()\n* ResidueIndexes()\n\nBasic example:\n```\nfrom funpdbe_validator.validator import Validator\nfrom funpdbe_validator.residue_index import ResidueIndexes\n\ndef run():\n    \"\"\"\n    Basic example of running the PDBe-KB/FunPDBe validator\n    :return:\n    \"\"\"\n    validator = Validator(\"name of the resource\") # Same as in the JSON\n    validator.load_schema()\n    validator.load_json(\"/path/to/data.json\")\n\n    if validator.basic_checks() and validator.validate_against_schema():\n        print(\"Passed data validations\")\n        residue_indexes = ResidueIndexes(validator.json_data)\n        if residue_indexes.check_every_residue():\n            print(\"Passed the index validation\")\n            return True\n    return False\n\n\nif __name__ == \"__main__\":\n    run()\n```\nUsing mmcif instead of PDBe-API for valiation:\nResidueIndexes class has optional arguments- 'mmcif_mode' and 'cif_file'. When mmcif_mode is set True, the validator uses given mmcif (set using cif_fie) for validation instead of PDBe-API.\n\n```\ndef run(resource_name, json_path, mmcif_mode=False, cif_file =None):\n    \"\"\"\n    Basic example of running the PDBe-KB/FunPDBe validator\n    :return: None\n    \"\"\"\n    validator = Validator(resource_name) # Same as in the JSON\n    validator.load_schema()\n    for json_file_path in glob.glob('%s*.json' % json_path):\n        validator.load_json(json_file_path)\n        if validator.basic_checks() and validator.validate_against_schema():\n            print(\"Passed data validations for %s\" % json_file_path)\n            residue_indexes = ResidueIndexes(validator.json_data,mmcif_mode,cif_file)\n            if residue_indexes.check_every_residue():\n                print(\"Passed the index validation for %s\" % json_file_path)\n                return True\n            else:\n                print(\"Failed index validation for %s: %s\" % (json_file_path, residue_indexes.mismatches))\n        else:\n            print(\"Failed data validations for %s: %s\" % (json_file_path, validator.error_log))\n    return False\n```\n\n### Using the \"basic_run.py\"\n\nThis script runs the validator for all the JSON files found at a specified path. **Note**: the path has to end with a /\n\n```\npython basic_run.py dataResourceName path/to/json/files/\n```\n\n### Using the Dockerized version\n\n```\ndocker build --tag funpdbe-validator-basic .\ndocker run funpdbe-validator-basic dataResourceName path/to/json/files/\n```\n\n### Running the tests\n\nRunning tests for the client is performed simply by using\n```\n$ pytest tests\n```\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/funpdbe-consortium/funpdbe-validator/tags).\n\n## Authors\n\n* **Mihaly Varadi** - *Initial work* - [mvaradi](https://github.com/mvaradi)\n\nSpecial thanks to:\n* Skoda Petr https://github.com/skodapetr\n* Radoslav Krivak https://github.com/rdk\n\n## License\n\nThis project is licensed under the EMBL-EBI License - see the [LICENSE](LICENSE) file for details\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Validate PDBe-KB JSONs by FunPDBe Schema",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "https://github.com/PDBe-KB/funpdbe-validator"
    },
    "split_keywords": [
        "json",
        "funpdbe_validator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d782d9b343c8842dd39b03a1a46466987d1725ae3e387830cc85b592963bce44",
                "md5": "09ba8069f567e8c61302e8400ad7fc88",
                "sha256": "6ebc1595e31ca0845e1aa2844284ab3b991832225d0fdfef3acdcd659bd6f0ff"
            },
            "downloads": -1,
            "filename": "funpdbe_validator-1.1.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "09ba8069f567e8c61302e8400ad7fc88",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 8473,
            "upload_time": "2023-11-06T16:25:29",
            "upload_time_iso_8601": "2023-11-06T16:25:29.617402Z",
            "url": "https://files.pythonhosted.org/packages/d7/82/d9b343c8842dd39b03a1a46466987d1725ae3e387830cc85b592963bce44/funpdbe_validator-1.1.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1d4bfa9aebd462387b32bb33939c6c0cd6107da7f3b36e53232488fb111cf38",
                "md5": "23eaa875c6d9fbf106d434a136655c1a",
                "sha256": "365efced161547875db16bd9982b977cfb179b1fb087d03d3ea3ddcc7282ca07"
            },
            "downloads": -1,
            "filename": "funpdbe-validator-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "23eaa875c6d9fbf106d434a136655c1a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8012,
            "upload_time": "2023-11-06T16:25:30",
            "upload_time_iso_8601": "2023-11-06T16:25:30.942954Z",
            "url": "https://files.pythonhosted.org/packages/c1/d4/bfa9aebd462387b32bb33939c6c0cd6107da7f3b36e53232488fb111cf38/funpdbe-validator-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-06 16:25:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PDBe-KB",
    "github_project": "funpdbe-validator",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "funpdbe-validator"
}
        
Elapsed time: 0.45117s