Pure-Rust cheminformatics — SMILES, fingerprints, 190+ descriptors, pKa, ADMET
Actively maintained. Last release 2 days ago, commits in 24 of the last 26 weeks. A safe choice.
pip install chematicchematic
Pure-Rust cheminformatics library for Python — SMILES parsing, descriptors, fingerprints, substructure search, formats, reactions, and bounded 3D tools.
See PyPI for available versions and the validation report for package results.
Installation
pip install chematic
Quick Start
import chematic
mol = chematic.from_smiles("CC(=O)Oc1ccccc1C(=O)O")
print(mol.mw, mol.tpsa)
print(chematic.tanimoto(mol.ecfp4(), chematic.from_smiles("CCO").ecfp4()))
svg = mol.to_svg()
See the Python notebook guide for descriptors and batch analysis and the API reference for molecule methods, indexed SDF, pickle and optional workflows. See Cleanup migration for error behavior in the unreleased source.
Molecular GNN input
Mol.ogb_graph_features() returns the OGB categorical graph schema as NumPy
int64 arrays. It works with molecules from SMILES, SDF records, and MOL2.
The keys are node_feat (N, 9), edge_index (2, 2E), edge_feat
(2E, 3), and num_nodes. The edges and their features have the same order,
with one edge in each direction per bond. PyTorch and PyG are optional:
import chematic
for source_index, record, error in chematic.iter_sdf_checked("ligands.sdf"):
if error is not None:
print(f"Rejected SDF record {source_index}: {error}")
continue
assert record is not None
graph = record.ogb_graph_features()
# Attach record.name and record.properties() as labels or IDs as needed.
# With PyTorch Geometric installed:
# import torch
# from torch_geometric.data import Data
# data = Data(
# x=torch.from_numpy(graph["node_feat"]),
# edge_index=torch.from_numpy(graph["edge_index"]),
# edge_attr=torch.from_numpy(graph["edge_feat"]),
# num_nodes=graph["num_nodes"],
# )
The default removes RDKit-removable hydrogen graph atoms, following OGB's
default SMILES conversion. Pass remove_hs=False to retain the atoms already
present in the molecule; this option does not add hydrogens. Unsupported
chemistry raises . This export contains categorical graph features,
not coordinates or SD properties. reports a rejected record
at its source index. Its default reader limits are 1 GiB and 100,000 records;
pass positive and overrides for larger files.
Use for V2000 or V3000 SDF input: it retains
explicitly unknown double-bond stereo (V2000 code 3 or V3000 ). The generic
has no record-level stereo diagnostic to read.
For a 3D SDF, chirality inferred by RDKit from coordinates can differ from
the chirality retained in from the CTAB wedge representation.