Skip to main content

ChemGED

ChemGED is a Python package for enabling the appoximate graph edit distance (GED) computation between chemicals. Normally, GED is a NP-hard problem, but ChemGED uses heuristics to approximate the GED in a reasonable time.

Installation

You can install ChemGED using pip:

pip install chemged

Usage

To use ChemGED, you just create an ApproximateChemicalGED object, and then call the compute_ged method with two chemical structures. They can be SMILES or RDKit Mol objects.

from chemged import ApproximateChemicalGED
ged_calc = ApproximateChemicalGED()

chemical1 = "CCO"  # SMILES of the first chemical
chemical2 = "CCN"  # SMILES of the second chemical

# you can use SMILES strings directly
approx_ged = ged_calc.compute_ged(chemical1, chemical2)

# you can also use RDKit Mol objects
from rdkit.Chem import MolFromSmiles
approx_ged = ged_calc.compute_ged(MolFromSmiles(chemical1), MolFromSmiles(chemical2))

ChemGED also implements pdist and cdist functions to compute pairwise distances between sets of chemicals. These will return as Numpy arrays.

from chemged import pdist, cdist

# Create a list of chemicals
chemicals = ["CCO", "CCN", "CC", "C"]

# Compute pairwise distances
distances_vector = pdist(chemicals)
print(distances_vector)  # Vector form

# Compute all-vs-all distances
distances_matrix = cdist(chemicals, chemicals)
print(distances_matrix)  # Square form

Documentation

You can read more detailed documentation in the docs folder.

Implementation

The approach used here uses bipartite graph matching[1], and most of its implementation in python is based off scripts from https://github.com/priba/aproximated_ged/tree/master. ChemGED uses RDKit to handle chemicals inside python.

References

[1] Riesen, Kaspar, and Horst Bunke. "Approximate graph edit distance computation by means of bipartite graph matching." Image and Vision computing 27.7 (2009): 950-959

Metadata

Release files for chemged 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chemged 0.1.1
File Size Uploaded Provenance Actions
chemged-0.1.1.tar.gz 12.2 kB Without provenance Details for chemged-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chemged 0.1.1
File Interpreter ABI Platform Actions
chemged-0.1.1-py3-none-any.whl Python 3 none any Details for chemged-0.1.1-py3-none-any.whl

Total release size: 25.4 kB

Release files / chemged-0.1.1.tar.gz

Download URL chemged-0.1.1.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09c5b6c7544ec0125e8f7cc326e2fdea8f719fdccedc5d1723b01f0721ec0f43
BLAKE2b-256 checksum
How to use checksums
75cb6e9c144cc8dec700ddf9b8967d873685a4cf8ae8526d7cb31ffbf3c0ca0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.9 Windows/10

Release files / chemged-0.1.1-py3-none-any.whl

Download URL chemged-0.1.1-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db8e65a6b06ab37d9d94bf96a7bec613082406ca1ebf7512e2abb7b18f1faf96
BLAKE2b-256 checksum
How to use checksums
f43226a78853348cf71420beb14c4f15bdb099d489a7561b3b41df3009ea8f85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.9 Windows/10

Security for chemged 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page