Skip to main content

A Python library for EnzymeML

Project description

PyEnzyme
PyPI - Version Build Badge

PyEnzyme is the interface to the data model EnzymeML and offers a convenient way to document and model research data. Lightweight syntax for rapid development of data management solution in enzymology and biocatalysis.

🧬 Features

  • Reproducible documentation of enzymatic and biocatalytic experiments.
  • Import from and export to the SBML-based markup language EnzymeML and more.
  • Fetch entities from CheBI, UniProt, PubChem, RHEA and PDB databases.
  • Visualize experimental results for inspection and publication.

⚡️ Quick start

Get started with PyEnzyme by running the following command

# Using PyPI
python -m pip install pyenzyme

Or build by source

git clone https://github.com/EnzymeML/PyEnzyme.git
cd PyEnzyme
python3 setup.py install

🚀 Try PyEnzyme in Google Colab

Get hands-on experience with PyEnzyme without any local installation! Try our interactive Google Colab notebook by clicking the badge below:

Open In Colab

⚙️ Package Options

PyEnzyme comes with many flavors, choose whether you want only the base installation, the modeling package or all of it using the following options.

# PySCeS - modeling
python -m pip install "pyenzyme[pysces]"

⚙️ Example code

This example will demonstrate how to create a simple EnzymeML document using PyEnzyme and how to use initializers from official databases Chebi and UniProt to gather metadata.

Create a simple EnzymeML document

import pyenzyme as pe

# Create a simple EnzymeML document
enzmldoc = pe.EnzymeMLDocument(name="Test")

vessel = enzmldoc.add_to_vessels(
    id="vessel_1",
    name="Vessel 1",
    volume=1.0,
    unit="l",  # Units are automatically converted to a UnitDefinition
)

# Add a protein from UniProt
protein = pe.fetch_uniprot("P07327", vessel_id=vessel.id)
enzmldoc.proteins.append(protein)

# Add a reaction from RHEA DB
reaction, participants = pe.fetch_rhea("RHEA:22864", vessel_id=vessel.id)
enzmldoc.small_molecules += participants
enzmldoc.reactions.append(reaction)

# Parse a tabular file to a measurement
measurements = pe.from_excel(
    path="measurements.xlsx",
    data_unit="mmol / l",
    time_unit="h",
)

enzmldoc.measurements += measurements

# Serialize to EnzymeML
pe.write_enzymeml(enzmldoc, "enzmldoc.json")

# Deserialize from EnzymeML
enzmldoc = pe.read_enzymeml("enzmldoc.json")

# Convert to SBML
sbml_doc = pe.to_sbml(enzmldoc, "enzmldoc.omex")

(Code should run as it is)

Compose an EnzymeML document

As an alternative to the manual creation of an EnzymeML document, you can use the compose function to create an EnzymeML document from a list of identifiers. This function will fetch the corresponding entities from the official databases and compose an EnzymeML document. Duplicate entities are removed to avoid redundancy.

import pyenzyme as pe

doc = pe.compose(
    name="test",
    proteins=["PDB:1A23"],
    small_molecules=["CHEBI:32551"],
    reactions=["RHEA:22864"],
)

pe.write_enzymeml(doc, "enzmldoc.json")

(Code should run as it is)

Please note, that by providing RHEA identifiers, the function will automatically fetch all associated CheBI molecules that are part of the reaction.

📖 Documentation and more examples

Explore all the features of PyEnzyme in our documentation and take part in Discussions and/or Issues.

🔙 Backwards compatibility

For backward compatibility with previous versions of PyEnzyme, this release includes the original v1.1.5 version of the package under the v1 subpackage. Users may continue to utilize the legacy API by importing from pyenzyme.v1 instead of pyenzyme. Please be aware that the dependencies for the current v2 implementation differ from those of v1 and must be installed separately using poetry install --with v1.

For new projects, we recommend utilizing the updated API available in the package root. Existing users of the legacy API are encouraged to migrate to the current version to benefit from the latest features and improvements.

🧪 Testing

In order to run tests there are two different ways. First you can utilize pytest directly by running the following:

python -m pytest -vv

Or you can the provided Dockerfile to run the tests in a containerized environment.

docker build -t pyenzyme .
docker run pyenzyme

⚠️ License

PyEnzyme is free and open-source software licensed under the BSD 2-Clause License.


Made with ❤️ by the EnzymeML Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyenzyme-2.1.1.tar.gz (154.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyenzyme-2.1.1-py3-none-any.whl (199.5 kB view details)

Uploaded Python 3

File details

Details for the file pyenzyme-2.1.1.tar.gz.

File metadata

  • Download URL: pyenzyme-2.1.1.tar.gz
  • Upload date:
  • Size: 154.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for pyenzyme-2.1.1.tar.gz
Algorithm Hash digest
SHA256 ddd1127502f52c41e856805c9b6ac3e5f0b20dc4b13e5a9e126d7f2ab65dbb02
MD5 6c991373a9111d68b43743807dc0dd65
BLAKE2b-256 5f30762d5668e4d55eb1b0cbe8bd7e98532ea2451da3bf6d0edd13a13690ef34

See more details on using hashes here.

File details

Details for the file pyenzyme-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyenzyme-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 199.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for pyenzyme-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd6bfdfd191e1518e7b83bba037e114db28c5c999e7900ad603f88de2d2cb236
MD5 90abdba5c94d2b41b6d6b474998be5ed
BLAKE2b-256 bf784c06be95320335f6cd6188ed37b1a2618f7ad1594e9f553b29368f224201

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page