Breadth-first Line Notation for Chemical Structures
Project description
BLINCS
Breadth-first Line Notation for Chemical Structures.
BLINCS is a compact line notation for molecules that encodes molecular structure as a breadth-first traversal of the spanning tree, recording ring closures as paired digits (similar to SMILES) but with a deterministic BFS ordering. It depends only on RDKit and the Python standard library.
A presentation from RDKit UGM 2025 is available here.
Installation
pip install blincs
Or from source:
git clone https://github.com/dehaenw/blincs.git
cd blincs
pip install .
Usage
Convert an RDKit mol to BLINCS:
from rdkit import Chem
from blincs import blincs
mol = Chem.MolFromSmiles("c1ccccc1")
bli = blincs.mol_to_blincs(mol)
# → 'cccccc%1%1'
Convert BLINCS back to an RDKit mol:
mol = blincs.blincs_to_mol("C1CCCC1")
# → RDKit RWMol for pentane
Use canonical=True for stereo-aware canonical encoding (recommended):
bli = blincs.mol_to_blincs(mol, canonical=True)
More examples in examples.ipynb.
Roundtrip accuracy
Benchmarked on ChEMBL 34 (2,310,851 molecules) — full InChI comparison:
| Category | Count | % |
|---|---|---|
| Full match (identical InChI) | 2,310,815 | 99.998% |
| Parse failures (RDKit cannot parse input) | 4 | 0.0002% |
| Decode failures (exotic polycyclic cages) | 7 | 0.0003% |
| Stereo mismatches | 25 | 0.001% |
The 25 remaining stereo mismatches are concentrated in highly symmetric cage systems (bispyridinium cages, adamantane/norbornane bridges, and symmetric halocyclohexanes) where CIP-based parity assignment is ambiguous.
On the 2,000-molecule stereo-containing subset (data/chembl_2k.smi),
roundtrip accuracy is 100% (all stereochemistry preserved).
Testing
pip install pytest
pytest tests/
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blincs-0.1.0.tar.gz.
File metadata
- Download URL: blincs-0.1.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7d44c4a28d78ab96cce3abc2cfc19c9813bd223224277f6c37f9a05085f7d85
|
|
| MD5 |
4389d5ae9344cc33c2bcc0b2ff4578bf
|
|
| BLAKE2b-256 |
d8bdae582615639faa0699792c49060468ba7216f71ea94c591e4866d79706e1
|
File details
Details for the file blincs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: blincs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ec819c9dc67da1321314adfbff3c878d40d5ab2a7221f42d0b1910014b34161
|
|
| MD5 |
7939d70a0f9bdab4d27e3e8980215b5c
|
|
| BLAKE2b-256 |
adec68e252c7b4d62d315c687dd7a80eee4e863713a79dfeaf28d0e88d633cad
|