chematic-wasm
WebAssembly bindings for chematic, a pure-Rust cheminformatics library.
Published to npm as @kent-tokyo/chematic.
Installation
Features
- Parse SMILES strings into molecule handles
- Molecular descriptors: MW, TPSA, LogP, Fsp3, QED, exact mass, rotatable bonds, HBD/HBA, aromatic ring count, Labute ASA
- Drug-likeness filters: Lipinski, Veber, Egan, REOS, Ghose
- EState indices (Hall & Kier 1991): per-atom values, sum/max/min
- Gasteiger-Marsili PEOE partial charges: per-heavy-atom charges
- VSA descriptors: SlogP_VSA (×12), SMR_VSA (×10), PEOE_VSA (×14)
- SA score: synthetic accessibility estimate [1, 10]
- Functional group identification (Ertl 2017 IFG)
- Canonical SMILES generation
- ECFP4/6, AtomPair, Torsion, and path fingerprints with Tanimoto similarity
- BRICS fragment count
- SDF/MOL block parsing
- Topological descriptors: Wiener index, Hall-Kier κ, χ connectivity indices, Bertz CT
- Shape descriptors (with 3D coordinates): PMI, NPR, radius of gyration, asphericity
- 2D SVG depiction with CPK colors and atom/bond highlighting
- SVG grid layout for multiple molecules
- Reaction SMILES/SMIRKS parsing and transform
- Add/remove explicit hydrogens
Usage
import init from '@kent-tokyo/chematic';
await ;
const mol = ; // aspirin
// Descriptors
console.log; // 13
console.log; // ~180.16
console.log; // "C9H8O4"
console.log; // ~63.6
console.log; // ~1.2
console.log; // ~0.111
console.log; // drug-likeness score [0, 1]
console.log; // ~180.042
console.log; // 1
console.log; // 4
console.log; // 3
console.log; // 1
console.log; // true
console.log; // canonical SMILES string
// BRICS fragmentation
console.log; // ≥ 2
// Fingerprint similarity
const caffeine = ;
console.log; // ECFP4 Tanimoto
console.log; // AtomPair Tanimoto
console.log; // Torsion Tanimoto
// Sprint Q: New descriptors (v0.1.15)
console.log; // synthetic accessibility [1,10]
console.log; // Labute approx. surface area (Ų)
// Gasteiger partial charges (per heavy atom)
const charges = JSON.;
console.log; // [-0.08, 0.12, -0.43, ...]
// VSA descriptor bins
const slogpVsa = JSON.;
const smrVsa = JSON.;
const peoeVsa = JSON.;
// Functional group identification
const ifg = JSON.;
console.log; // [{"atoms":[1,2,3],"types":"OC=O"}, ...]
Version History
v0.1.94 (2026-06-12):
- SA Score corpus expanded: 188 FDA molecules (1415 unique fragments)
- Enhanced fingerprints: True MHFP, True ERG, path FP with bond types
- Full multi-sphere CIP stereochemistry for R/S assignment
- InChI stereo layer round-trip support (tetrahedral and E/Z)
v0.1.93 (2026-06-12):
- Full multi-sphere CIP priority rules
- Correct stereochemistry assignment for complex chiral centers
v0.1.92 (2026-06-12):
- InChI stereo layer parsing (tetrahedral
/tand E/Z/b) - Path fingerprint with bond type interleaving
v0.1.91 (2026-06-12):
- True MHFP (structural fragment hashing)
- True ERG (Ertl 2017 functional group detection)
Bundle Size
~500 KB gzip / ~1.3 MB raw (reduced from ~819 KB gzip in v0.4.17, -38.5%).
PNG rasterization (tiny_skia) is excluded from the WASM build — use SVG output instead. All SVG depiction APIs remain fully available.
Building from source