Skip to content

Commit

Permalink
Merge pull request #3 from mite-standard/dev_mmz
Browse files Browse the repository at this point in the history
Dev mmz
  • Loading branch information
mmzdouc committed Aug 5, 2024
2 parents 5360a0d + 1489387 commit 897fb77
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 61 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish Python distribution package to PyPI

on:
release:
types: [published]

jobs:
build:
name: Build distribution package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python distribution package to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mite_schema
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1] 05-08-2024

### Changed

- schema/enzyme: 'databaseIds' is now an object, with allowed database cross-links as keys (before: an array of database-crosslinks)
- schema/reactions: 'databaseIds' is now an object, with allowed database cross-links as keys (before: an array of database-crosslinks)

## [1.0] 05-08-2024

### Added

- Implemented MITE Schmea and SchemaManager()
- Implemented MITE Schema and SchemaManager()

### Changed

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ More information about the schema can be found in [the MITE publication](https:/

## Quick Start

To validate your MITE-formatted .json-file, run:

- `hatch run mite_schema -i <input.json>`

### For developers

- Install `python3`
- Install `hatch` using one of the methods described [here](https://hatch.pypa.io/1.12/install/)
- Download or clone this repository
- Run `hatch -v env create dev`. This will download and install the appropriate Python version and any required packages
Expand Down
65 changes: 36 additions & 29 deletions mite_schema/schema/definitions/enzyme.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@
"type": "string"
},
"databaseIds": {
"type": "array",
"items": {
"$ref": "#/$defs/databaseId"
},
"uniqueItems": true
"type": "object",
"additionalProperties": false,
"properties": {
"uniprot": {
"$ref": "#/$defs/uniprot"
},
"genpept": {
"$ref": "#/$defs/genpept"
},
"mibig": {
"$ref": "#/$defs/mibig"
}
}
},
"auxiliaryEnzymes": {
"title": "Specify any required auxiliary enzymes that are co-forming the maturation machinery.",
Expand All @@ -39,11 +47,16 @@
"type": "string"
},
"databaseIds": {
"type": "array",
"items": {
"$ref": "#/$defs/databaseId"
},
"uniqueItems": true
"type": "object",
"additionalProperties": false,
"properties": {
"uniprot": {
"$ref": "#/$defs/uniprot"
},
"genpept": {
"$ref": "#/$defs/genpept"
}
}
}
}
}
Expand All @@ -58,26 +71,20 @@
}
},
"$defs": {
"databaseId": {
"uniprot": {
"title": "Uniprot ID reference.",
"type": "string",
"oneOf": [
{
"title": "Uniprot ID reference.",
"pattern": "^uniprot:[A-Z0-9]+$"
},
{
"title": "GenBank GenPept ID (= protein ID, GenBank gene products)",
"pattern": "^genpept:[A-Z]{3}[0-9]{5,7}\\.[0-9]+$"
},
{
"title": "MIBiG ID reference",
"pattern": "^mibig:BGC\\d{7}$"
},
{
"title": "Temporary MIBiG ID reference",
"pattern": "^mibig:new\\d+$"
}
]
"pattern": "^[A-Z0-9]+$"
},
"genpept": {
"title": "GenBank GenPept ID (= protein ID, GenBank gene products)",
"type": "string",
"pattern": "^[A-Z]{3}[0-9]{5,7}\\.[0-9]+$"
},
"mibig": {
"title": "MIBiG ID reference",
"type": "string",
"pattern": "^BGC\\d{7}$|^new\\d+$"
}
}
}
44 changes: 26 additions & 18 deletions mite_schema/schema/definitions/reactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@
"uniqueItems": true
},
"databaseIds": {
"type": "array",
"items": {
"$ref": "#/$defs/databaseId"
},
"uniqueItems": true
"type": "object",
"additionalProperties": false,
"properties": {
"rhea": {
"$ref": "#/$defs/rhea"
},
"mite": {
"$ref": "#/$defs/mite"
},
"ec": {
"$ref": "#/$defs/ec"
}
}
},
"reactionSMARTS": {
"title": "A reaction SMARTS pattern describing the (sub)structure to match and the reaction to perform.",
Expand Down Expand Up @@ -139,20 +147,20 @@
"Other"
]
},
"databaseId": {
"title": "Cross-reference to databases.",
"rhea": {
"title": "RHEA cross-reference",
"type": "string",
"oneOf": [
{
"pattern": "^rhea:(\\d+)$"
},
{
"pattern": "^MITE(\\d{7,7})$"
},
{
"pattern": "^EC [0-9]+(\\.[0-9]+){0,3}$"
}
]
"pattern": "^(\\d+)$"
},
"mite": {
"title": "MITE cross-reference",
"type": "string",
"pattern": "^MITE(\\d{7})$"
},
"ec": {
"title": "EC number (2-4 identifiers)",
"type": "string",
"pattern": "^EC [0-9]+(\\.[0-9]+){0,3}$"
},
"evidence": {
"type": "object",
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion mite_schema/schema_manager/schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ def validate_mite(self: Self, instance: dict):
jsonschema.validate(instance=instance, schema=entry, registry=registry)
except jsonschema.exceptions.ValidationError as e:
raise ValueError(
f"SchemaManager: Validation of instance against MITE schema led to an error: '{e!s}"
f"SchemaManager: Validation of instance against "
f"MITE schema led to an error: '{e!s}"
) from e
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "mite_schema"
version = "1.0"
version = "1.1"
description = "Containing the Minimum Information about a Tailoring Enzymes schema and auxiliary methods"
readme = "README.md"
requires-python = ">=3.12"
Expand All @@ -24,7 +24,6 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Chemistry"
]

dependencies = [
"argparse~=1.4",
"coloredlogs~=15.0",
Expand All @@ -33,6 +32,10 @@ dependencies = [
"referencing~=0.35",
]

[project.urls]
Homepage = "https://github.com/mite-standard/mite_schema"
Issues = "https://github.com/mite-standard/mite_schema/issues"

[project.scripts]
mite_schema = "mite_schema.main:main"

Expand Down
21 changes: 12 additions & 9 deletions tests/example_files/example_valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"enzyme": {
"name": "McjC",
"description": "Lassopeptide ATP-dependent lactam synthetase (C-protein, asparagine synthetase-like)",
"databaseIds": [
"uniprot:Q9X2V9",
"genpept:AAD28496.1",
"mibig:BGC0000581"
],
"databaseIds": {
"uniprot": "Q9X2V9",
"genpept": "AAD28496.1",
"mibig": "BGC0000581"
},
"references": [
"doi:10.1128/jb.181.8.2659-2662.1999",
"doi:10.1002/cbic.201200016"
Expand All @@ -39,10 +39,10 @@
{
"name": "McjB",
"description": "Lassopeptide cysteine protease. Required for macrolactam-synthethase function (folds and cleaves precursor peptide)",
"databaseIds": [
"uniprot:Q9X2V8",
"genpept:AAD28495.1"
]
"databaseIds": {
"uniprot": "Q9X2V8",
"genpept": "AAD28495.1"
}
}
]
},
Expand All @@ -67,6 +67,9 @@
"description": "Lasso macrocyclisation of microcin J25 after precursor cleavage, leading to mature product."
}
],
"databaseIds": {
"mite": "MITE0000000"
},
"evidence": [
{
"evidenceCode": [
Expand Down

0 comments on commit 897fb77

Please sign in to comment.