oxmol Documentation¶
oxmol
is a Python wrapper, written using PyO3, for ChemCore, a cheminformatics
library implemented in Rust by Rich Apodaca. This follows the ‘minimal molecule API’
outlined by Apodaca in a blog post.
This package is currently a work in progress, it is missing some of the following key pieces:
- A fully-featured SMILES parser (this is being worked on, but isn’t yet in oxmol)
- Substructure matching
- Coordinate representations and embedding
- Descriptor generation
These will be expanded upon in future versions. At present, molecules can be instantiated and their ‘minimal molecule’ functionality works.
The project’s GitHub repository can be found here. New contributors are welcome. Any bugs or significant frustrations can be reported in the issue tracker.
from oxmol import AtomSpec, BondSpec, Molecule
C, H, O = AtomSpec('C'), AtomSpec('H'), AtomSpec('O')
atoms = [C, O, H, H, H, H]
bond_indices = [(0, 1), (1, 2), (0, 3), (0, 4), (0, 5)]
bonds = [BondSpec(sid, tid, 1) for (sid, tid) in bond_indices]
mol = Molecule(atoms, bonds)
print(mol)
# PyMolecule with 6 atoms and 5 bonds.
for (sid, tid) in mol.edges:
print(mol.element(sid), mol.element(tid))
print(mol.bond_order(sid, tid))
# PyElement::C Element::O
# PyBondOrder::Single
# PyElement::O Element::H
# PyBondOrder::Single
# PyElement::C Element::H
# PyBondOrder::Single
# PyElement::C Element::H
# PyBondOrder::Single
# PyElement::C Element::H
# PyBondOrder::Single